結果

問題 No.7 プライムナンバーゲーム
ユーザー mkawa2
提出日時 2019-04-18 17:45:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-09-22 09:21:08
合計ジャッジ時間 2,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

while 1:
    for lk in L:
        for s in sosu:
            wk=lk+s
            if wk not in L:
                if wk==n:
                    print("Win")
                    exit()
                elif wk<n:
                    W.add(wk)

    for wk in W:
        for s in sosu:
            lk=wk+s
            if lk not in W:
                if lk==n:
                    print("Lose")
                    exit()
                elif lk<n:
                    L.add(lk)
0