백준 #4153번 직각삼각형

jhj·2024년 2월 18일

백준 JAVA

목록 보기
391/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		long a = sc.nextInt();
		long b = sc.nextInt();
		long c = sc.nextInt();
		
		while(a != 0 && b != 0 && c != 0) {
			if(Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2) || Math.pow(b, 2) + Math.pow(c, 2) == Math.pow(a, 2) || Math.pow(a, 2) + Math.pow(c, 2) == Math.pow(b, 2)) {
				System.out.println("right");
			}else {
				System.out.println("wrong");
			}
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글