結果

問題 No.7 プライムナンバーゲーム
ユーザー DialBirdDialBird
提出日時 2017-03-12 14:51:02
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 152 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 9,060 KB
最終ジャッジ日時 2023-07-24 20:48:11
合計ジャッジ時間 1,927 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
8,416 KB
testcase_01 AC 14 ms
8,288 KB
testcase_02 AC 152 ms
9,004 KB
testcase_03 AC 23 ms
8,436 KB
testcase_04 AC 17 ms
8,376 KB
testcase_05 AC 17 ms
8,416 KB
testcase_06 AC 48 ms
8,464 KB
testcase_07 AC 40 ms
8,632 KB
testcase_08 AC 24 ms
8,436 KB
testcase_09 AC 67 ms
9,056 KB
testcase_10 AC 14 ms
8,364 KB
testcase_11 AC 40 ms
8,620 KB
testcase_12 AC 98 ms
9,004 KB
testcase_13 AC 103 ms
8,984 KB
testcase_14 AC 129 ms
9,060 KB
testcase_15 AC 127 ms
9,004 KB
testcase_16 AC 118 ms
8,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt

class Yukicoder:
    def __init__(self):
        self.n = int(input())

    def run(self):
        dp = set([0,1])
        prime_checker = [1]*10001
        prime_list = set([])

        for i in range(2, self.n + 1):
            if prime_checker[i] == 1:
                prime_list.add(i)
                for j in range(i*2, 10001, i):
                    prime_checker[j] = 0

            for j in prime_list:
                if (i - j) not in dp:
                    dp.add(i)
                    break

        if self.n in dp:
            return "Win"
        else:
            return "Lose"

y = Yukicoder()
print(y.run())
0