#2285502

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

Source Code Status Test Cases
    Policy: public     Reviewed: 20    
00.07 sec    25636 KB    48 lines     1181 bytes    2017-04-26 19:30

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] a) throws IOException{

//    	for(int i=1; i<=9; i++) {
//    		for (int j=1; j<=9; j++) {
//    			System.out.println(i + "x" + j + "=" + (i*j));
//    		}
//    	}

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

            String line1 = br.readLine();
            int N = Integer.parseInt(line1);

            for (int i=0; i<N; i++) {
            	String line = br.readLine();
            	String[] tmp = line.split(" ");
            	int[] tri = {Integer.parseInt(tmp[0]), Integer.parseInt(tmp[1]),Integer.parseInt(tmp[2])};


            	if (pitagoras(tri[0], tri[1], tri[2])
            			|| pitagoras(tri[1], tri[2], tri[0])
            			|| pitagoras(tri[2], tri[0], tri[1]) ) {

            		System.out.println("YES");
            	} else {
            		System.out.println("NO");
            	}

            }
        }


    }


    private static boolean pitagoras(int a, int b, int c) {
    	return Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2) ? true : false;
    }
}


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

Status
Judge: 1/1 JAVA CPU: 00.07 sec Memory: 25636 KB Length: 1181 B 2017-04-26 19:30 2017-04-26 19:30
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.07 sec 25636 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags