結果

問題 No.7 プライムナンバーゲーム
ユーザー TomoyarnTomoyarn
提出日時 2023-01-04 09:21:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 812 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 76,312 KB
最終ジャッジ日時 2023-08-18 08:18:56
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,224 KB
testcase_01 AC 68 ms
71,312 KB
testcase_02 AC 80 ms
76,052 KB
testcase_03 AC 79 ms
75,992 KB
testcase_04 AC 78 ms
76,280 KB
testcase_05 WA -
testcase_06 AC 79 ms
76,056 KB
testcase_07 AC 81 ms
76,244 KB
testcase_08 AC 80 ms
76,136 KB
testcase_09 WA -
testcase_10 AC 69 ms
71,268 KB
testcase_11 AC 82 ms
76,068 KB
testcase_12 AC 83 ms
76,152 KB
testcase_13 AC 83 ms
76,312 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 85 ms
75,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

prm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499]
N = int(input())
dp = [0] * (N + 1)
for i in range(N + 1):
    dp[i] = True

if N <= 10:
    print("Win")
    exit()

for i in range(11, N + 1):
    winflag = False
    for p in prm:
        if p >= i:
            break
        elif dp[i - p] == False:
            winflag = True
            break
    dp[i] = winflag

print("Win" if dp[i] else "Lose")
    

0