hwangnk1004 / Algorithm

0 stars 0 forks source link

StepByStep #주사위 게임 #272

Open hwangnk1004 opened 4 years ago

hwangnk1004 commented 4 years ago

import java.util.Scanner;

public class Main { public static void main(String args[]) {

    Scanner scanner = new Scanner(System.in);

    int n = scanner.nextInt();

    int sum = 0;
    int x = 0;

    for (int q = 0; q < n; q++) {
        int max = 0;
        int[] arr = new int[6];

        for (int i = 0; i < 3; i++) {
            arr[scanner.nextInt()-1]++;
        }

        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == 3) {
                max = 10000 + (i+1) * 1000;
                break;
            } else if (arr[i] == 2) {
                max = 1000 + (i+1) * 100;
                break;
            } else if (arr[i] == 1) {
                x = Math.max(x, (i+1));
                max = x * 100;
            }
        }

        sum = Math.max(sum, max);

    }
    System.out.println(sum);

}

}