Pages

1/19/2014

UVA 11854 Solution

import java.util.Arrays;
import java.util.Scanner;

class Main{
//class 11854 {

/**UVA java solution to  11854
* @param args
*/
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
int[] side = new int[3];
while(sc.hasNext()){

for (int i=0; i<3;i++) {
side[i] =sc.nextInt();
}
if ((side[1]==0) && (side[0] ==0) && (side[2] ==0)) break;

Arrays.sort(side);
if(Math.pow(side[2], 2) == (Math.pow(side[1], 2) + Math.pow(side[0], 2))) {
System.out.println("right");
}
else
System.out.println("wrong");

}

}

}

No comments :

Post a Comment