#1415909

Solution for 0003: Is it a Right Triangle? by rhnd

Source Code Status Test Cases
    Policy: public     Reviewed: 314    
00.04 sec    18372 KB    34 lines     980 bytes    2015-06-25 02:04
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	private final static String NEG = "NO\n";
	private final static String AFF = "YES\n";

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in),1024);
		int number = Integer.parseInt(br.readLine());
		int sides[] = new int[3];
		StringTokenizer tknz;
		StringBuilder builder = new StringBuilder();

		for (; 0 < number; number--) {
			tknz = new StringTokenizer(br.readLine());
			for (int i = 0; i < 3; i++) {
				sides[i] = Integer.parseInt(tknz.nextToken());
			}
			Arrays.sort(sides);
			if (sides[0] * sides[1] * sides[2] % 60 != 0) {
				builder.append(NEG);
			} else if (Math.pow(sides[0], 2) + Math.pow(sides[1], 2) != Math.pow(sides[2], 2)) {
				builder.append(NEG);
			} else {
				builder.append(AFF);
			}
		}
		System.out.print(builder);
	}
}

Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 1/1 JAVA CPU: 00.04 sec Memory: 18372 KB Length: 980 B 2015-06-25 02:04 2015-06-25 02:04
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.04 sec 18372 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags