結果

問題 No.7 プライムナンバーゲーム
ユーザー PalearcticPalearctic
提出日時 2018-09-15 22:21:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 983 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-09 04:33:15
合計ジャッジ時間 7,535 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 983 ms
11,008 KB
testcase_03 AC 88 ms
10,752 KB
testcase_04 AC 46 ms
10,752 KB
testcase_05 AC 45 ms
10,752 KB
testcase_06 AC 285 ms
10,752 KB
testcase_07 AC 205 ms
10,752 KB
testcase_08 AC 107 ms
10,752 KB
testcase_09 AC 426 ms
10,752 KB
testcase_10 AC 29 ms
10,752 KB
testcase_11 AC 205 ms
10,752 KB
testcase_12 AC 653 ms
11,008 KB
testcase_13 AC 688 ms
10,880 KB
testcase_14 AC 904 ms
11,008 KB
testcase_15 AC 867 ms
10,880 KB
testcase_16 AC 793 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

if(N==2):
    print("Lose")
elif(N==3):
    print("Win")
else:
    primelist=[2]
    for i in range(3,N-1,2):
        for j in primelist:
            if(i%j==0):
                break
        else:
            primelist.append(i)
            
    a=[2,2,0,0]
    for i in range(4,N+1):
        for x in [j for j in primelist if(j<i)]:
            if(a[i-x]==0):
                a.append(1)
                break
        else:
            a.append(0)
    if(a[-1]==0):
        print("Lose")
    else:
        print("Win")
0