結果

問題 No.24 数当てゲーム
ユーザー abcabc
提出日時 2016-10-20 05:14:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 1,202 bytes
コンパイル時間 1,776 ms
コンパイル使用メモリ 73,516 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-08-15 08:41:09
合計ジャッジ時間 3,690 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
56,044 KB
testcase_01 AC 111 ms
55,936 KB
testcase_02 AC 110 ms
55,600 KB
testcase_03 AC 115 ms
55,860 KB
testcase_04 AC 108 ms
55,848 KB
testcase_05 AC 111 ms
55,660 KB
testcase_06 AC 111 ms
56,016 KB
testcase_07 AC 114 ms
55,728 KB
testcase_08 AC 113 ms
55,472 KB
testcase_09 AC 117 ms
56,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        final int MAX = 10;
        int NUM_TURN = sc.nextInt();

        boolean[] answer = new boolean[MAX];
        Arrays.fill(answer, true);

        for (int i = 0; i < NUM_TURN; i++) {

            int num1 = sc.nextInt();
            int num2 = sc.nextInt();
            int num3 = sc.nextInt();
            int num4 = sc.nextInt();

            String included = sc.next();

            if ("YES".equals(included)) {

                for (int j = 0; j < MAX; j++) {

                    if (!(j == num1 || j == num2 || j == num3 || j == num4)) {
                        answer[j] = false;
                    }

                }

            } else if ("NO".equals(included)) {

                answer[num1] = false;
                answer[num2] = false;
                answer[num3] = false;
                answer[num4] = false;

            }

        }

        for (int i = 0; i < MAX; i++) {

            if (answer[i]) {

                System.out.println(i);
                break;

            }

        }

    }

}
0