結果

問題 No.7 プライムナンバーゲーム
ユーザー 炭酸水炭酸水
提出日時 2022-05-13 08:16:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 8,440 KB
最終ジャッジ日時 2023-09-28 10:07:18
合計ジャッジ時間 28,247 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,558 ms
8,352 KB
testcase_01 AC 1,451 ms
8,292 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1,490 ms
8,372 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1,467 ms
8,364 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1,490 ms
8,320 KB
testcase_14 AC 1,457 ms
8,428 KB
testcase_15 AC 1,467 ms
8,288 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

pn = [True for _ in range(10000)]

pn[0] = False
pn[1] = False

for i in range(10000):
    if pn[i]:
        j = 2
        while i * j <= 9999:
            pn[i * j] = False
            j += 1
pn_list = []
for i in range(10000):
    if pn[i]:
        pn_list.append(i)

z = [0 for _ in range(10001)]
z[2] = False
z[3] = False
for i in pn_list:
    if 2 + i <= 10000:
        z[2 + i] = True
    if 3 + i <= 10000:
        z[3 + i] = True

for i in range(10001):
    for j in pn_list:
        if z[i] and i + j <= 10000 and z[i + j] == 0:
            z[i + j] = False

if z[int(input())]:
    print("Win")
else:
    print("Lose")
0