結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,164 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 AC 194 ms
8,312 KB
testcase_04 AC 60 ms
8,208 KB
testcase_05 WA -
testcase_06 AC 916 ms
8,768 KB
testcase_07 AC 538 ms
8,400 KB
testcase_08 AC 255 ms
8,384 KB
testcase_09 WA -
testcase_10 AC 17 ms
8,220 KB
testcase_11 AC 550 ms
8,284 KB
testcase_12 AC 2,068 ms
8,848 KB
testcase_13 AC 2,203 ms
8,884 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2,587 ms
8,712 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[i] else "Lose")
0