結果

問題 No.7 プライムナンバーゲーム
コンテスト
ユーザー r_ishida
提出日時 2026-01-02 18:56:05
言語 Python3
(3.14.2 + numpy 2.4.0 + scipy 1.16.3)
結果
WA  
実行時間 -
コード長 693 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 613 ms
コンパイル使用メモリ 21,408 KB
実行使用メモリ 15,500 KB
最終ジャッジ日時 2026-01-02 18:56:12
合計ジャッジ時間 6,336 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import math
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

n = I()

p = [2]
for i in range(2, 10000):
    for j in p:
        if i % j == 0:
            break
    else:
        p.append(i)

dp = [0] * (n+1)

for i in range(4, n+1):
    ret = False
    for j in p:
        if j > n-2:
            break
        if not dp[n-j]:
            ret = True
            break
    dp[i] = ret

if dp[n]:
    print("Win")
else:
    print("Lose")
0