結果

問題 No.24 数当てゲーム
コンテスト
ユーザー face4
提出日時 2018-04-16 21:31:11
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 1,037 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,668 ms
コンパイル使用メモリ 82,160 KB
実行使用メモリ 44,740 KB
最終ジャッジ日時 2026-03-14 09:33:36
合計ジャッジ時間 2,442 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] arr = new int[10];
        while (n-- > 0) {
            String[] input = br.readLine().split(" ");
            if (input[4].equals("YES")) {
                for (int i = 0; i < 4; i++) {
                    arr[Integer.parseInt(input[i])]++;
                }
            } else if (input[4].equals("NO")) {
                for (int i = 0; i < 4; i++) {
                    arr[Integer.parseInt(input[i])]--;
                }
            }
        }

        int maxIndex = 0;
        int maxValue = arr[0];
        for (int i = 1; i < 10; i++) {
            if (maxValue < arr[i]) {
                maxIndex = i;
                maxValue = arr[i];
            }
        }

        System.out.println(maxIndex);
    }
}
0