結果

問題 No.7 プライムナンバーゲーム
ユーザー けむけむけむけむ
提出日時 2021-06-22 21:00:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 622 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 12,880 KB
最終ジャッジ日時 2023-09-05 21:45:59
合計ジャッジ時間 6,865 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def sosu(N):
    nums = [n for n in range(2, N + 1)]
    i = 0
    while i <= len(nums) - 1:
        j = i + 1
        while j <= len(nums) - 1:
            if nums[j] % nums[i] == 0:
                nums.pop(j)
            else:
                j = j + 1
        i += 1
    return nums

def check(N):
    sosus = sosu(N)
    wins = [0, 1]
    for i in range(4, N + 1):
        for s in sosus:
            if (i - s) not in wins:
                wins.append(i)
                break
    if N in wins:
        return 'Win'
    else:
        return 'Lose'

if __name__ == '__main__':
    N = int(input())
    print(check(N))
0