結果

問題 No.7 プライムナンバーゲーム
ユーザー pluto77pluto77
提出日時 2016-07-15 09:26:44
言語 Python2
(2.7.18)
結果
AC  
実行時間 281 ms / 5,000 ms
コード長 332 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,696 KB
最終ジャッジ日時 2024-04-09 04:01:01
合計ジャッジ時間 2,705 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
6,564 KB
testcase_01 AC 12 ms
6,692 KB
testcase_02 AC 281 ms
6,688 KB
testcase_03 AC 28 ms
6,692 KB
testcase_04 AC 15 ms
6,692 KB
testcase_05 AC 15 ms
6,692 KB
testcase_06 AC 86 ms
6,692 KB
testcase_07 AC 62 ms
6,692 KB
testcase_08 AC 34 ms
6,692 KB
testcase_09 AC 126 ms
6,692 KB
testcase_10 AC 11 ms
6,696 KB
testcase_11 AC 62 ms
6,688 KB
testcase_12 AC 197 ms
6,692 KB
testcase_13 AC 209 ms
6,692 KB
testcase_14 AC 271 ms
6,688 KB
testcase_15 AC 258 ms
6,688 KB
testcase_16 AC 239 ms
6,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_7

n=int(raw_input())
primes=[2]
for i in xrange(3,n+1,2):
 for p in primes:
  if i%p==0:
   break
 else:
  primes.append(i)
memo=[False for i in xrange(n+1)]
for i in xrange(2,n+1):
 if memo[i]:
  continue
 for p in primes:
  if i+p>n:
   break
  memo[i+p]=True
  
if memo[n]:
 print "Win"
else:
 print "Lose"
0