코테/백준
[백준/JAVA] 삼각형 외우기
imname1am
2023. 3. 29. 12:47
반응형
🔺 문제
10101번: 삼각형 외우기
문제의 설명에 따라 Equilateral, Isosceles, Scalene, Error 중 하나를 출력한다.
www.acmicpc.net
🔺 코드
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int a = Integer.parseInt(br.readLine());
int b = Integer.parseInt(br.readLine());
int c = Integer.parseInt(br.readLine());
if(a == 60 && b == 60 && c == 60) {
sb.append("Equilateral");
}
else if((a+b+c) == 180) {
if(a==b || b==c || a==c) {
sb.append("Isosceles");
} else {
sb.append("Scalene");
}
}
else if((a+b+c) != 180) {
sb.append("Error");
}
System.out.println(sb);
}
}
노가다...
반응형