結果
問題 | No.7 プライムナンバーゲーム |
ユーザー |
![]() |
提出日時 | 2017-01-05 09:39:56 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 3,054 ms / 5,000 ms |
コード長 | 391 bytes |
コンパイル時間 | 438 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-10-01 15:55:44 |
合計ジャッジ時間 | 20,957 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
n=int(input()) a=list(range(n+1)) a[1]=0 i=2 while i**2<=n: j=2 while i*j<=n: a[i*j]=0 j+=1 i+=1 list=[] for i in a: if i>0: list.append(i) dp=[-1]*(n+1) dp[0]=0 dp[1]=0 for i in range(2,n+1): s=0 p=0 while p<len(list) and list[p] <= i: s+=dp[i-list[p]] p+=1 dp[i]=0 if s>0 else 1 print("Win" if dp[n]==0 else "Lose")