結果

問題 No.7 プライムナンバーゲーム
ユーザー MaboyMaboy
提出日時 2017-04-22 12:06:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 584 ms / 5,000 ms
コード長 301 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-09 04:14:32
合計ジャッジ時間 4,856 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 584 ms
11,392 KB
testcase_03 AC 65 ms
10,880 KB
testcase_04 AC 40 ms
10,752 KB
testcase_05 AC 38 ms
10,752 KB
testcase_06 AC 181 ms
11,136 KB
testcase_07 AC 136 ms
10,880 KB
testcase_08 AC 78 ms
11,008 KB
testcase_09 AC 261 ms
11,008 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 136 ms
10,880 KB
testcase_12 AC 390 ms
11,264 KB
testcase_13 AC 414 ms
11,136 KB
testcase_14 AC 578 ms
11,392 KB
testcase_15 AC 501 ms
11,520 KB
testcase_16 AC 472 ms
11,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
i=1
P=[i for i in range(N+1)]
while i < N**0.5:
  i+=1
  if i in P:
    P=[x if x%i!=0 else 0 for x in P]
    P[i]=i
P=set(P)
P^=set([0,1])
L=set([])
for i in range(2,N+1):
  f=0
  for j in P:
    if (i-j) in L:
      f=1;break
  if f==0:
    L.add(i)
print("Lose" if N in L else "Win")
0