Pages

1/19/2014

UVA 11479 Solution

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


class Main {

    /**UVA java solution to  11479
* @param args
*/
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
long[] side = new long[3];
long tc = sc.nextLong();
for (long j=1 ; j<=tc; j++){

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

Arrays.sort(side);
if( (side[0] + side[1])<=side[2] || (side[0]<=0) )
System.out.printf("Case %d: %s\n",j,"Invalid");
else if(side[0]==side[2])
System.out.printf("Case %d: %s\n",j,"Equilateral");
else if ( (side[0] == side[1]) || (side[1] == side[2]))
System.out.printf("Case %d: %s\n",j,"Isosceles");
else System.out.printf("Case %d: %s\n",j,"Scalene");
}

}
}

No comments :

Post a Comment