結果

問題 No.24 数当てゲーム
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-21 10:37:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 1,182 bytes
コンパイル時間 4,259 ms
コンパイル使用メモリ 76,920 KB
実行使用メモリ 57,600 KB
最終ジャッジ日時 2023-10-23 18:45:02
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
57,056 KB
testcase_01 AC 135 ms
57,188 KB
testcase_02 AC 136 ms
57,476 KB
testcase_03 AC 136 ms
57,512 KB
testcase_04 AC 134 ms
57,380 KB
testcase_05 AC 134 ms
55,476 KB
testcase_06 AC 135 ms
57,440 KB
testcase_07 AC 137 ms
57,600 KB
testcase_08 AC 136 ms
57,224 KB
testcase_09 AC 136 ms
57,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        int[] d = new int[n];
        String[] r = new String[n];
        for(int i=0; i<n; i++) {
            a[i] = in.nextInt();
            b[i] = in.nextInt();
            c[i] = in.nextInt();
            d[i] = in.nextInt();
            r[i] = in.next();
        }

        boolean[] bool = new boolean[10];
        for(int i=0; i<n; i++) {
            if(r[i].equals("YES")) {
                for(int j=0; j<10; j++) {
                    if(j == a[i] || j == b[i] || j == c[i] || j == d[i]) {
                        continue;
                    }
                    bool[j] = true;
                }
            } else if(r[i].equals("NO")) {
                bool[a[i]] = bool[b[i]] = bool[c[i]] = bool[d[i]] = true;
            }
        }

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