結果

問題 No.24 数当てゲーム
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-23 15:23:36
言語 Java19
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 1,356 bytes
コンパイル時間 2,551 ms
コンパイル使用メモリ 73,884 KB
実行使用メモリ 49,768 KB
最終ジャッジ日時 2023-09-29 12:16:57
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,228 KB
testcase_01 AC 42 ms
49,768 KB
testcase_02 AC 43 ms
49,492 KB
testcase_03 AC 42 ms
49,704 KB
testcase_04 AC 43 ms
49,472 KB
testcase_05 AC 43 ms
49,352 KB
testcase_06 AC 42 ms
49,236 KB
testcase_07 AC 43 ms
49,300 KB
testcase_08 AC 42 ms
49,572 KB
testcase_09 AC 42 ms
49,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());

        int[] a = new int[10];

        int maxDuplication = 0;

        for (int i = 0; i < N; i++) {
            String[] line = reader.readLine().split(" ");
            String answer = line[4];

            if (answer.equals("YES")) {
                for (int j = 0; j < 10; j++) {
                    for (int k = 0; k < 4; k++) {
                        if (j == Integer.parseInt(line[k])) {
                            a[j] = a[j] + 1;
                        }
                    }
                }
                maxDuplication += 1;
            } else {
                for (int j = 0; j < 10; j++) {
                    for (int k = 0; k < 4; k++) {
                        if (j == Integer.parseInt(line[k])) {
                            a[j] = a[j] - 1;
                        }
                    }
                }
            }
        }


        for (int i = 0; i < 10; i++) {
            if (a[i] == maxDuplication) {
                System.out.println(i);
            }
        }

    }
}

0