結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2017-12-21 07:47:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-12-17 20:36:25 |
合計ジャッジ時間 | 5,009 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 8 |
ソースコード
n=int(input()) import math prime=[] s=[1]*(n+1) s[0]=s[1]=0 for i in range(2,n,2): s[i]=0 for i in range(3,int(math.sqrt(n))): for j in range(2,math.ceil(n/i)): if s[i*j]==1: s[i*j]=0 for i in range(n): if s[i]==1: prime.append(i) winlose=[-1]*(n+1) winlose[0],winlose[1]=1,1 for i in range(2,n+1): for j in prime: if i<j: break if winlose[i-j]==-1: winlose[i]=1 break if winlose[-1]==1: print("Win") else: print("Lose")