문제 확인하기
2. 정답 코드 (Java, memory: 18300KB, time: 236ms)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
for (int i = 1; i <= T; i++) {
int A = scanner.nextInt();
int B = scanner.nextInt();
int C = scanner.nextInt();
System.out.print("Case #" + i + ": ");
classifyTriangle(A, B, C);
}
scanner.close();
}
private static void classifyTriangle(int A, int B, int C) {
if (A + B > C && A + C > B && B + C > A) {
if (A == B && B == C) {
System.out.println("equilateral");
} else if (A == B || B == C || A == C) {
System.out.println("isosceles");
} else {
System.out.println("scalene");
}
} else {
System.out.println("invalid!");
}
}
}