結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
![]() |
提出日時 | 2019-04-19 00:48:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 367 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-09-22 10:50:23 |
合計ジャッジ時間 | 2,080 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 RE * 12 |
ソースコード
def f(n): if n<4: return "Lose" if memo[n]!=0: return memo[n] for s in sosu: if s>n-2: break if f(n-s)=="Lose": memo[n]="Win" return "Win" memo[n] = "Lose" return "Lose" n=int(input()) memo=[0]*(n+1) sosu=[2] dp=[0]*(n+1) dp[2]=-1 dp[3]=-1 for i in range(3,n+1,2): for s in sosu: if i%s==0: break else: sosu+=[i] print(f(n))