結果

問題 No.7 プライムナンバーゲーム
ユーザー DialBirdDialBird
提出日時 2017-03-12 14:52:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 197 ms / 5,000 ms
コード長 648 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-04-09 04:11:27
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 196 ms
11,776 KB
testcase_03 AC 41 ms
11,008 KB
testcase_04 AC 33 ms
10,880 KB
testcase_05 AC 33 ms
11,008 KB
testcase_06 AC 78 ms
11,136 KB
testcase_07 AC 66 ms
11,008 KB
testcase_08 AC 44 ms
11,008 KB
testcase_09 AC 106 ms
11,648 KB
testcase_10 AC 32 ms
10,752 KB
testcase_11 AC 67 ms
11,136 KB
testcase_12 AC 153 ms
11,776 KB
testcase_13 AC 158 ms
11,648 KB
testcase_14 AC 197 ms
11,776 KB
testcase_15 AC 186 ms
11,648 KB
testcase_16 AC 174 ms
11,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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