結果

問題 No.7 プライムナンバーゲーム
ユーザー TomoyarnTomoyarn
提出日時 2023-01-04 08:10:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 71,808 KB
最終ジャッジ日時 2023-08-18 07:23:25
合計ジャッジ時間 2,780 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,284 KB
testcase_01 AC 74 ms
71,464 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 74 ms
71,320 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 73 ms
71,412 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 74 ms
71,136 KB
testcase_15 AC 72 ms
71,528 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def is_prime(n):
    sqrt_n = math.ceil(math.sqrt(n))
    for i in range(2, sqrt_n):
        if n % i == 0:
            return False
    return True
    
N = int(input())

if N <= 10:
    print("Win")
    exit()

for i in range(N, 2, -1):
    if is_prime(i):
        A = i
        break

for i in range(A - 1, 2, -1):
    if is_prime(i):
        B = i
        break

if B - A > 10:
    print("Win")
else:
    print("Lose")
0