結果

問題 No.7 プライムナンバーゲーム
ユーザー zinnnia123zinnnia123
提出日時 2019-09-01 23:33:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,060 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-09 04:44:53
合計ジャッジ時間 21,130 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 2,991 ms
11,136 KB
testcase_03 AC 215 ms
10,880 KB
testcase_04 AC 77 ms
10,880 KB
testcase_05 AC 75 ms
10,880 KB
testcase_06 AC 871 ms
10,880 KB
testcase_07 AC 598 ms
10,880 KB
testcase_08 AC 282 ms
10,752 KB
testcase_09 AC 1,337 ms
10,752 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 606 ms
10,880 KB
testcase_12 AC 2,115 ms
11,008 KB
testcase_13 AC 2,246 ms
11,008 KB
testcase_14 AC 3,060 ms
11,008 KB
testcase_15 AC 2,802 ms
11,008 KB
testcase_16 AC 2,627 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

LC = [0]*(N+1)
LC[0] = 1
LC[1] = 1

pn = [2]
for L in range(3, N+1):
    chk = True
    for L2 in pn:
        if L%L2 == 0:chk = False
    if chk == True:pn.append(L)

for i in range(2,N+1):
    A = list(filter(lambda x: x <= i, pn))
    flag = True
    for j in range(len(A)):
        if LC[i - A[j]] == 0:
            flag = False
    if flag == False:
        LC[i] = 1

if LC[N] == 0:
    print("Lose")
else:
    print("Win")
0