글 작성자: 취업중인 피터팬
728x90

https://www.acmicpc.net/problem/10101

 

10101번: 삼각형 외우기

문제의 설명에 따라 Equilateral, Isosceles, Scalene, Error 중 하나를 출력한다.

www.acmicpc.net

 

문제 설명

 

삼각형을 빙자한 조건문 문제입니다.

 

문제 풀이

 

사실 이 문제가 왜 정답률이 55%나 떨어졌는지 잘 모르겠습니다.

그냥 조건대로 쭉 작성하시면 무리없이 문제를 푸실 수 있으십니다.

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int each1 = sc.nextInt();
int each2 = sc.nextInt();
int each3 = sc.nextInt();
if(each1==60 && each2==60 && each3==60){
System.out.println("Equilateral");
} else if (each1+each2+each3 == 180) {
if(each1 == each2){
System.out.println("Isosceles");
} else if (each1 == each3) {
System.out.println("Isosceles");
} else if (each2 == each3) {
System.out.println("Isosceles");
} else {
System.out.println("Scalene");
}
} else if (each1+each2+each3 != 180) {
System.out.println("Error");
}
}
}