結果

問題 No.7 プライムナンバーゲーム
ユーザー 百
提出日時 2023-04-12 17:09:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 978 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-17 05:01:36
合計ジャッジ時間 7,299 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 978 ms
11,136 KB
testcase_03 AC 85 ms
10,624 KB
testcase_04 AC 42 ms
10,752 KB
testcase_05 AC 40 ms
10,752 KB
testcase_06 AC 292 ms
10,880 KB
testcase_07 AC 199 ms
10,880 KB
testcase_08 AC 105 ms
10,752 KB
testcase_09 AC 440 ms
10,880 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 203 ms
10,880 KB
testcase_12 AC 664 ms
11,008 KB
testcase_13 AC 729 ms
11,008 KB
testcase_14 AC 926 ms
11,136 KB
testcase_15 AC 898 ms
11,136 KB
testcase_16 AC 835 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

P=list(range(2,N+1))
p=[]

while P:
    a=P.pop(0)
    for i in P:
        if i%a==0:
            P.remove(i)
    p.append(a)

d=[False for i in range(N+1)]
d[0],d[1]=True,True

for i in range(2,N+1):
    for j in p:
        if i-j<0:
            break
        if d[i-j]==False:
            d[i]=True
            break

if d[N]:
    print('Win')
else:
    print('Lose')
0