結果

問題 No.7 プライムナンバーゲーム
ユーザー mahiro72mahiro72
提出日時 2021-10-08 16:11:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 8,940 KB
最終ジャッジ日時 2023-09-30 09:19:27
合計ジャッジ時間 20,486 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,216 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 AC 194 ms
8,376 KB
testcase_04 AC 59 ms
8,308 KB
testcase_05 WA -
testcase_06 AC 905 ms
8,880 KB
testcase_07 AC 541 ms
8,436 KB
testcase_08 AC 253 ms
8,232 KB
testcase_09 WA -
testcase_10 AC 16 ms
8,152 KB
testcase_11 AC 550 ms
8,440 KB
testcase_12 AC 2,137 ms
8,716 KB
testcase_13 AC 2,235 ms
8,900 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2,539 ms
8,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

hurui = set(range(2,N+1))
for i in range(2,N+1):
    for j in range(i*2,N+1,i):
        hurui.discard(j)

f = [False]*10000
f[0]=f[1]=True
for i in range(2,N+1):
    flag = False
    for j in hurui:
        if i-j>=0:
            f[i]|=f[i-j]
print("Win"if f[N] else "Lose")
0