240410 삼각형과 세 변

Jongleee·2024년 4월 10일
0

TIL

목록 보기
543/576
public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	while (true) {
		int[] arr = new int[3];
		StringTokenizer st = new StringTokenizer(br.readLine());
		arr[0] = Integer.parseInt(st.nextToken());
		arr[1] = Integer.parseInt(st.nextToken());
		arr[2] = Integer.parseInt(st.nextToken());

		if (arr[0] == 0 && arr[1] == 0 && arr[2] == 0)
			break;

		Arrays.sort(arr);

		if (arr[2] >= arr[0] + arr[1]) {
			System.out.println("Invalid");
		} else if (arr[0] == arr[1] && arr[1] == arr[2]) {
			System.out.println("Equilateral");
		} else if (arr[0] == arr[1] || arr[1] == arr[2] || arr[0] == arr[2]) {
			System.out.println("Isosceles");
		} else {
			System.out.println("Scalene");
		}
	}
}

출처:https://www.acmicpc.net/problem/5073

0개의 댓글