結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー g-tetsuyag-tetsuya
提出日時 2016-05-22 15:46:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 597 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-04-24 19:30:29
合計ジャッジ時間 5,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 27 ms
10,880 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 26 ms
10,880 KB
testcase_04 AC 27 ms
10,880 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 26 ms
10,880 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,880 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 30 ms
10,880 KB
testcase_11 AC 27 ms
10,880 KB
testcase_12 AC 26 ms
10,880 KB
testcase_13 AC 28 ms
10,880 KB
testcase_14 AC 27 ms
10,752 KB
testcase_15 AC 28 ms
10,752 KB
testcase_16 AC 28 ms
10,880 KB
testcase_17 AC 26 ms
10,752 KB
testcase_18 AC 27 ms
10,880 KB
testcase_19 AC 27 ms
10,752 KB
testcase_20 AC 28 ms
10,880 KB
testcase_21 AC 27 ms
10,880 KB
testcase_22 AC 37 ms
10,880 KB
testcase_23 AC 36 ms
10,880 KB
testcase_24 AC 169 ms
11,264 KB
testcase_25 AC 176 ms
11,264 KB
testcase_26 AC 175 ms
11,264 KB
testcase_27 AC 168 ms
11,264 KB
testcase_28 AC 163 ms
11,264 KB
testcase_29 AC 168 ms
11,264 KB
testcase_30 AC 166 ms
11,264 KB
testcase_31 AC 166 ms
11,136 KB
testcase_32 AC 168 ms
11,264 KB
testcase_33 AC 163 ms
11,264 KB
testcase_34 AC 146 ms
11,264 KB
testcase_35 AC 157 ms
11,136 KB
testcase_36 AC 97 ms
11,008 KB
testcase_37 AC 171 ms
11,136 KB
testcase_38 AC 150 ms
11,264 KB
testcase_39 AC 170 ms
11,264 KB
testcase_40 AC 158 ms
11,264 KB
testcase_41 WA -
testcase_42 AC 149 ms
11,136 KB
testcase_43 AC 173 ms
11,136 KB
testcase_44 AC 119 ms
11,136 KB
testcase_45 AC 27 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def is_prime(n):
    if n == 2:
        return True
    return pow(2, n-1, n) == 1

def min_prime(n, prime_list):
    for p in prime_list:
        if n % p == 0:
            return p
    return n

L, H = map(int, input().split())

prime_list = [i for i in range(2, (int)(math.sqrt(H)) + 1) if is_prime(i)]

H_half = math.floor(H / 2) + 1

for p in reversed(prime_list):
    for i in reversed(range(p, math.floor(H / p) + 1)):
        if L <= i * p <= H:
            if min_prime(i, prime_list) >= p:
                print(i * p)
                exit(0)
        else:
            break
0