結果

問題 No.7 プライムナンバーゲーム
ユーザー yn
提出日時 2015-09-25 16:49:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 234 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-01 15:36:23
合計ジャッジ時間 4,503 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())

M = 10000
table = [True] * (M + 1)
num = []

for i in range(2, M + 1):
    if not table[i]:
        continue
    k = i + i
    while k < M + 1:
        table[k] = False
        k += i

    num.append(i)

memo = [False] * 10001

for i in range(2,10001):
    if memo[i]:
        continue
    for p in num:
        if i + p > 10000:
            break
        memo[i+p] = True

if memo[n]:
    print("Win")
else:
    print("Lose")
0