ACM (TJU) : 2803



package volume_XIX;

import java.util.Scanner;

public class Id_2803 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		Scanner input = new Scanner (System.in);
		
		int testCase = input.nextInt();
		
		while ( testCase != 0 ) {
			double a = input.nextDouble();
			double b = input.nextDouble();
			double c = input.nextDouble();
			
			double sq = b * b - 4 * a * c;
			if ( sq < 0 )
				System.out.println ("No solution!");
			
			else {
				double sq1 = -b + Math.sqrt(sq);
				sq1 /= (2 * a);
				
				double sq2 = -b - Math.sqrt(sq);
				sq2 /= (2 * a);
				
				if ( sq1 == sq2 )
					System.out.printf ("%.3f\n", sq1);
				else if ( sq1 > sq2 )
					System.out.printf ("%.3f %.3f\n", sq2, sq1 );
				else
					System.out.printf ("%.3f %.3f\n", sq1, sq2 );
			}
			testCase--;
		}
	}
}


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s