結果

問題 No.24 数当てゲーム
ユーザー polygon283polygon283
提出日時 2023-09-05 21:21:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 760 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 7,916 KB
最終ジャッジ日時 2023-09-05 21:21:25
合計ジャッジ時間 1,149 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 16 ms
7,856 KB
testcase_03 AC 15 ms
7,860 KB
testcase_04 AC 16 ms
7,848 KB
testcase_05 AC 15 ms
7,916 KB
testcase_06 AC 15 ms
7,776 KB
testcase_07 AC 15 ms
7,876 KB
testcase_08 AC 16 ms
7,808 KB
testcase_09 AC 15 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

possible_numbers = set(range(10))
    
    # ステップ2: ターン数Nを入力として受け取る
N = int(input())

for _ in range(N):
        # ステップ3: 各ターンで、太郎君の提示した数字4つと二郎君の答えを入力として受け取る
    *numbers, answer = input().split()
    numbers = set(map(int, numbers))
        
    if answer == "NO":
            # ステップ4: "NO"の場合、提示された数字を全ての数字のリストから除外
            possible_numbers -= numbers
    else:
            # ステップ5: "YES"の場合、そのターンで提示された数字だけを候補として保持
            possible_numbers &= numbers

    # ステップ6: 答えを出力
print(possible_numbers.pop())
0