본문 바로가기
PS/백준

백준 - 주사위 세개

by 종안이 2023. 11. 11.

 

아니 브론즈4인데 왜 이렇게 어렵냐고 장난함??

package org.example;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        String s = bf.readLine();
        String[] split = s.split(" ");

        int num1 = Integer.parseInt(split[0]);
        int num2 = Integer.parseInt(split[1]);
        int num3 = Integer.parseInt(split[2]);
        List<Integer> array = new ArrayList<>(List.of(num1, num2, num3));

        int result = 0;
        if (num1 == num2 && num1 == num3) {
            result = 10000 + ( num1 * 1000 );
            System.out.println(result);
        } else if (num1 == num2 || num2 == num3 || num1 == num3) {
            if (num1 == num2) {
                result = (num2 * 100) + 1000;
                System.out.println(result);
            } else if (num1 == num3) {
                result = (num1 * 100) + 1000;
                System.out.println(result);
            } else if (num2 == num3) {
                result = (num2 * 100) + 1000;
                System.out.println(result);
            } else if (num1==num3){
                result = (num1 * 100) + 1000;
                System.out.println(result);
            }
        } else {
            Integer max = Collections.max(array);
            result = max * 100;
            System.out.println(result);
        }

    }
}

'PS > 백준' 카테고리의 다른 글

백준 - 알고리즘 수업 - 피보나치 수1  (0) 2023.11.12
백준 - 직사각형 탈출  (1) 2023.11.11
백준 - 최소공배수  (0) 2023.11.10
백준 - 최대공약수와 최소공배수  (0) 2023.11.10
백준 - 일곱 난쟁이  (0) 2023.11.09

댓글