結果

問題 No.7 プライムナンバーゲーム
ユーザー tnoda_
提出日時 2015-07-29 18:44:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 791 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2024-10-01 15:35:26
合計ジャッジ時間 14,693 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_prime(x):
    for i in range(2, x):
        if x % i == 0:
            return False
    return True

primes = [x for x in range(2, 10000) if is_prime(x)]
memo = [False] * 10010
for i in range(2, 10010):
    if memo[i]:
        continue
    for p in primes:
        if i + p > 10000:
            break
        memo[i+p] = True
if memo[input()]:
    print('Win')
else:
    print('Lose')
0