結果

問題 No.7 プライムナンバーゲーム
ユーザー tnoda_tnoda_
提出日時 2015-07-29 18:44:11
言語 Python2
(2.7.18)
結果
AC  
実行時間 912 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2024-04-09 03:49:01
合計ジャッジ時間 17,254 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 908 ms
7,040 KB
testcase_01 AC 907 ms
7,040 KB
testcase_02 AC 908 ms
7,168 KB
testcase_03 AC 906 ms
7,040 KB
testcase_04 AC 912 ms
7,040 KB
testcase_05 AC 907 ms
7,168 KB
testcase_06 AC 907 ms
6,948 KB
testcase_07 AC 911 ms
6,948 KB
testcase_08 AC 910 ms
6,944 KB
testcase_09 AC 909 ms
7,040 KB
testcase_10 AC 908 ms
7,168 KB
testcase_11 AC 911 ms
7,040 KB
testcase_12 AC 911 ms
7,168 KB
testcase_13 AC 912 ms
7,040 KB
testcase_14 AC 911 ms
7,168 KB
testcase_15 AC 908 ms
7,040 KB
testcase_16 AC 906 ms
7,040 KB
権限があれば一括ダウンロードができます

ソースコード

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