結果

問題 No.7 プライムナンバーゲーム
ユーザー netyo715netyo715
提出日時 2021-06-21 11:34:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 137 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 9,812 KB
最終ジャッジ日時 2023-09-05 01:51:29
合計ジャッジ時間 5,074 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,800 KB
testcase_01 AC 18 ms
8,896 KB
testcase_02 AC 605 ms
9,812 KB
testcase_03 AC 56 ms
9,068 KB
testcase_04 AC 27 ms
8,844 KB
testcase_05 WA -
testcase_06 AC 207 ms
9,340 KB
testcase_07 AC 120 ms
9,172 KB
testcase_08 AC 68 ms
9,036 KB
testcase_09 WA -
testcase_10 AC 18 ms
8,860 KB
testcase_11 AC 121 ms
9,132 KB
testcase_12 AC 434 ms
9,680 KB
testcase_13 AC 452 ms
9,768 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 497 ms
9,676 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]*100000
f[0] = True
f[1] = True
for i in range(2, N):
    flag = False
    for j in hurui:
        if j > i:
            continue
        if not f[i-j]:
            flag = True
            break
    f[i] = flag

if f[N-1]:
    print("Win")
else:
    print("Lose")
0