結果

問題 No.24 数当てゲーム
ユーザー tentententen
提出日時 2020-11-10 10:00:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 1,002 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 73,280 KB
実行使用メモリ 55,976 KB
最終ジャッジ日時 2023-09-29 23:18:22
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,704 KB
testcase_01 AC 126 ms
55,976 KB
testcase_02 AC 121 ms
55,444 KB
testcase_03 AC 126 ms
55,972 KB
testcase_04 AC 124 ms
55,908 KB
testcase_05 AC 124 ms
55,976 KB
testcase_06 AC 122 ms
55,688 KB
testcase_07 AC 124 ms
55,924 KB
testcase_08 AC 126 ms
55,444 KB
testcase_09 AC 123 ms
55,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean[] isNotTrue = new boolean[10];
        for (int i = 0; i < n; i++) {
            HashSet<Integer> used = new HashSet<>();
            for (int j = 0; j < 4; j++) {
                used.add(sc.nextInt());
            }
            if ("YES".equals(sc.next())) {
                for (int j = 0; j < 10; j++) {
                    if (!used.contains(j)) {
                        isNotTrue[j] = true;
                    }
                }
            } else {
                for (int j = 0; j < 10; j++) {
                    if (used.contains(j)) {
                        isNotTrue[j] = true;
                    }
                }
            }
        }
        for (int i = 0; i < 10; i++) {
            if (!isNotTrue[i]) {
                System.out.println(i);
                return;
            }
        }
    }
}
0