흔한 QA 엔지니어

[백준] 2480번 : 주사위 세개 - JAVA 본문

BAEKJOON

[백준] 2480번 : 주사위 세개 - JAVA

블로그 닉네임 입력 제한 수는 몇 자인가요? 2025. 9. 23. 09:24

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

가장 특수한 케이스부터 순서대로 작성합니다!

import java.util.*;

class Main{
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		
		if(x == y && y == z && x == z) {
			System.out.println(10000 + x * 1000);
		} else if(x == y || y == z || x == z) {
			int same = 0;
			if(x == y) same = x;
			if(y == z) same = y;
			else same = x;
			System.out.println(1000 + same * 100);
		} else {
			int max = Math.max(x, Math.max(y, z));
			System.out.println(max * 100);
		}
	}
}