https://www.acmicpc.net/problem/2480
3개 케이스 단순구현
Math.max를 쓰면 더 간단해질것 같다;;
package backjun;
import java.util.Scanner;
public class ThreeDice {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int firNum = in.nextInt();
int secNum = in.nextInt();
int trdNum = in.nextInt();
int Answer = 0;
//모두 같을 때
if(firNum==secNum&&secNum==trdNum){
Answer = 10000+trdNum*1000;
//모두 다를 때
}else if(firNum!=secNum&&secNum!=trdNum&&firNum!=trdNum){
int Max = 0;
if(Max<firNum){
Max = firNum;
}
if(Max<secNum){
Max = secNum;
}
if(Max<trdNum){
Max = trdNum;
}
Answer = Max *100;
// 2개만 같을때
}else{
if(firNum==secNum){
Answer = 1000+firNum*100;
}
if(secNum==trdNum){
Answer = 1000+secNum*100;
}
if(firNum==trdNum){
Answer = 1000+firNum*100;
}
}
System.out.println(Answer);
}
}
'IT_tech > 알고리즘' 카테고리의 다른 글
백준10757 ) 큰수 A+B - JAVA (0) | 2022.08.23 |
---|---|
백준25304) 영수증 -JAVA (0) | 2022.08.22 |
백준)오븐시계 - 자바 (0) | 2022.08.19 |
백준) 1427 소트인사이드 -JAVA (0) | 2020.08.15 |
백준) 2751 수정렬하기 2 -JAVA (0) | 2020.08.05 |