반응형
🔺 문제
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);
}
}
노가다...
반응형
'코테 > 백준' 카테고리의 다른 글
[백준/JAVA] 10813번: 공 바꾸기 (0) | 2023.03.30 |
---|---|
[백준/JAVA] 10810번: 공 넣기 (0) | 2023.03.30 |
[백준/JAVA] 9063번: 대지 (0) | 2023.03.29 |
[백준/JAVA] 1085번: 직사각형에서 탈출 (0) | 2023.03.29 |
[백준/JAVA] 11653번: 소인수분해 (0) | 2023.03.28 |