結果
問題 | No.7 プライムナンバーゲーム |
ユーザー | Dexctersu |
提出日時 | 2017-12-21 00:39:29 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 10,864 KB |
実行使用メモリ | 8,468 KB |
最終ジャッジ日時 | 2023-08-22 11:10:21 |
合計ジャッジ時間 | 4,258 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
8,120 KB |
testcase_01 | AC | 16 ms
8,276 KB |
testcase_02 | AC | 471 ms
8,376 KB |
testcase_03 | AC | 43 ms
8,112 KB |
testcase_04 | AC | 24 ms
8,292 KB |
testcase_05 | WA | - |
testcase_06 | AC | 143 ms
8,384 KB |
testcase_07 | AC | 102 ms
8,316 KB |
testcase_08 | AC | 54 ms
8,172 KB |
testcase_09 | WA | - |
testcase_10 | AC | 16 ms
8,116 KB |
testcase_11 | AC | 102 ms
8,228 KB |
testcase_12 | AC | 330 ms
8,440 KB |
testcase_13 | AC | 361 ms
8,440 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 385 ms
8,380 KB |
ソースコード
n=int(input()) import math prime=[] s=[1]*n s[0]=s[1]=0 for i in range(4,n,2): if s[i]==1: s[i]=0 for i in range(3,int(math.sqrt(n))+1): for j in range(2,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")