結果

問題 No.7 プライムナンバーゲーム
ユーザー otsunekootsuneko
提出日時 2021-05-03 15:24:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 76,640 KB
最終ジャッジ日時 2023-09-29 11:37:16
合計ジャッジ時間 2,801 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,548 KB
testcase_01 AC 70 ms
71,408 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 74 ms
75,612 KB
testcase_05 AC 77 ms
75,764 KB
testcase_06 WA -
testcase_07 AC 80 ms
76,452 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 79 ms
76,212 KB
testcase_13 AC 79 ms
76,624 KB
testcase_14 AC 79 ms
76,524 KB
testcase_15 AC 80 ms
76,500 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    for i in range(2, n+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    table = [ i-1 for i in range(1, n+1) if is_prime[i-1]] # 素数のリスト
    return table

N = int(input())

prime = sieve(N)

if len(prime)%2:
    print("Lose")
else:
    print("Win")
0