結果

問題 No.7 プライムナンバーゲーム
ユーザー mkawa2mkawa2
提出日時 2019-04-18 17:45:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 11,076 KB
最終ジャッジ日時 2023-10-22 08:21:52
合計ジャッジ時間 2,141 ms
ジャッジサーバーID
(参考情報)
judge9 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,148 KB
testcase_01 AC 29 ms
10,148 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 31 ms
10,236 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 75 ms
10,500 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 101 ms
10,252 KB
testcase_14 AC 122 ms
10,316 KB
testcase_15 AC 120 ms
11,072 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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