結果

問題 No.7 プライムナンバーゲーム
ユーザー mkawa2mkawa2
提出日時 2020-01-02 22:52:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 608 ms / 5,000 ms
コード長 398 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-09 04:48:07
合計ジャッジ時間 5,452 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 608 ms
10,880 KB
testcase_03 AC 66 ms
10,752 KB
testcase_04 AC 40 ms
10,880 KB
testcase_05 AC 39 ms
10,880 KB
testcase_06 AC 203 ms
10,880 KB
testcase_07 AC 145 ms
10,752 KB
testcase_08 AC 82 ms
10,880 KB
testcase_09 AC 293 ms
10,752 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 142 ms
10,880 KB
testcase_12 AC 432 ms
10,752 KB
testcase_13 AC 470 ms
10,880 KB
testcase_14 AC 607 ms
11,008 KB
testcase_15 AC 594 ms
10,752 KB
testcase_16 AC 556 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
sosu=[2]
dp=[0]*(n+1)
dp[2]=-1
dp[3]=-1
for i in range(3,n+1,2):
    for s in sosu:
        if i%s==0:
            break
    else:
        sosu+=[i]

for i in range(4,n+1):
    for s in sosu:
        if s>i-2:
            dp[i]=-1
            break
        if dp[i-s]==-1:
            dp[i]=1
            break
    else:
        dp[i]=-1
print("Win") if dp[-1]==1 else print("Lose")
0