結果

問題 No.7 プライムナンバーゲーム
ユーザー miztommiztom
提出日時 2024-03-12 15:14:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 62,252 KB
最終ジャッジ日時 2024-03-12 15:14:54
合計ジャッジ時間 2,484 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 69 ms
62,232 KB
testcase_03 AC 45 ms
59,896 KB
testcase_04 AC 43 ms
59,896 KB
testcase_05 AC 42 ms
59,896 KB
testcase_06 AC 51 ms
62,232 KB
testcase_07 AC 49 ms
62,240 KB
testcase_08 AC 48 ms
62,252 KB
testcase_09 AC 57 ms
62,232 KB
testcase_10 AC 35 ms
53,460 KB
testcase_11 AC 50 ms
62,240 KB
testcase_12 AC 62 ms
62,232 KB
testcase_13 AC 86 ms
62,232 KB
testcase_14 AC 68 ms
62,232 KB
testcase_15 AC 67 ms
62,232 KB
testcase_16 AC 64 ms
62,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
p=[1]*-~n
p[0]=p[1]=0
for i in range(n+1):
    if p[i]:
        for j in range(i*i,n+1,i):p[j]=0
p=[i for i in range(n+1)if p[i]]
dp=[1]*-~n
dp[0]=dp[1]=0
for i in range(n+1):
    for j in p:
        if j>i:break
        dp[i]&=dp[i-j]
    dp[i]^=1
print("LWoisne"[dp[n]::2])
0