結果

問題 No.7 プライムナンバーゲーム
ユーザー tomiyancetomiyance
提出日時 2019-11-19 23:26:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 424 bytes
コンパイル時間 1,994 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-15 03:29:10
合計ジャッジ時間 7,552 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
def get_sieve_of_eratosthenes(n):
  data = [i for i in range(2, n + 1)]
  for d in data:
    data = [x for x in data if (x == d or x % d != 0)]
  return data

is_win = [0] * (N+1)
is_win[0] = 1
is_win[1] = 1
for i in range(2,N+1):
  for j in [x for x in get_sieve_of_eratosthenes(i) if x <= i]:
    if not is_win[i - j]:
      is_win[i] = 1
      break
if is_win[N]:
    print('Win')
else:
    print('Lose')
0