結果

問題 No.24 数当てゲーム
ユーザー hnthnt
提出日時 2019-12-06 00:05:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 1,097 bytes
コンパイル時間 3,357 ms
コンパイル使用メモリ 72,328 KB
実行使用メモリ 55,992 KB
最終ジャッジ日時 2023-08-24 19:28:55
合計ジャッジ時間 5,305 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,364 KB
testcase_01 AC 122 ms
55,840 KB
testcase_02 AC 121 ms
55,372 KB
testcase_03 AC 123 ms
55,668 KB
testcase_04 AC 120 ms
55,940 KB
testcase_05 AC 120 ms
55,940 KB
testcase_06 AC 120 ms
55,480 KB
testcase_07 AC 124 ms
55,992 KB
testcase_08 AC 121 ms
55,616 KB
testcase_09 AC 120 ms
55,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class no24 {
    public static void main(String[] args) {
        boolean[] b = new boolean[10];
        Arrays.fill(b, true);
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        for (int i = 0; i < N; i++) {
            int[] input = {sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()};
            if (sc.next().equals("NO")) {
                for (int j : input) {
                    b[j] = false;
                }
            } else {
                for (int j = 0; j < 10; j++) {
                    boolean bb = true;
                    for (int k : input) {
                        if (j == k) {
                            bb = false;
                            break;
                        }
                    }
                    if (bb) {
                        b[j] = false;
                    }
                }
            }
        }
        for (int i = 0; i < 10; i++) {
            if (b[i]) {
                System.out.println(i);
            }
        }
    }
}
0