結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー eitahoeitaho
提出日時 2016-05-14 10:28:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 66 ms / 1,000 ms
コード長 498 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 9,552 KB
最終ジャッジ日時 2023-08-29 00:58:46
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,476 KB
testcase_01 AC 16 ms
8,368 KB
testcase_02 AC 16 ms
8,476 KB
testcase_03 AC 16 ms
8,372 KB
testcase_04 AC 16 ms
8,412 KB
testcase_05 AC 16 ms
8,492 KB
testcase_06 AC 16 ms
8,416 KB
testcase_07 AC 16 ms
8,484 KB
testcase_08 AC 16 ms
8,392 KB
testcase_09 AC 16 ms
8,420 KB
testcase_10 AC 16 ms
8,304 KB
testcase_11 AC 16 ms
8,488 KB
testcase_12 AC 16 ms
8,416 KB
testcase_13 AC 16 ms
8,416 KB
testcase_14 AC 16 ms
8,464 KB
testcase_15 AC 16 ms
8,292 KB
testcase_16 AC 16 ms
8,296 KB
testcase_17 AC 15 ms
8,464 KB
testcase_18 AC 15 ms
8,500 KB
testcase_19 AC 15 ms
8,468 KB
testcase_20 AC 16 ms
8,344 KB
testcase_21 AC 16 ms
8,472 KB
testcase_22 AC 20 ms
8,544 KB
testcase_23 AC 20 ms
8,468 KB
testcase_24 AC 59 ms
9,496 KB
testcase_25 AC 58 ms
9,404 KB
testcase_26 AC 66 ms
9,520 KB
testcase_27 AC 60 ms
9,400 KB
testcase_28 AC 61 ms
9,412 KB
testcase_29 AC 59 ms
9,480 KB
testcase_30 AC 57 ms
9,328 KB
testcase_31 AC 58 ms
9,544 KB
testcase_32 AC 58 ms
9,432 KB
testcase_33 AC 59 ms
9,536 KB
testcase_34 AC 54 ms
9,268 KB
testcase_35 AC 56 ms
9,440 KB
testcase_36 AC 38 ms
9,040 KB
testcase_37 AC 58 ms
9,380 KB
testcase_38 AC 54 ms
9,448 KB
testcase_39 AC 59 ms
9,392 KB
testcase_40 AC 55 ms
9,436 KB
testcase_41 AC 54 ms
9,320 KB
testcase_42 AC 52 ms
9,380 KB
testcase_43 AC 59 ms
9,552 KB
testcase_44 AC 47 ms
8,992 KB
testcase_45 AC 16 ms
8,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
L, R = map(int, input().split())
ans, maxP = 0, 0
sqrt = int(R**0.5)
N = sqrt + 10
isprime = [1] * N

for i in range(2, N):
    if isprime[i]:
        for b in range(i + i, N, i):
            isprime[b] = 0
primes = [p for p in range(2, N) if isprime[p]]
smaller = list(primes)

for p in reversed(primes):
    smaller.pop()
    for x in reversed(range(max(p * p, (L + p - 1) // p * p), R + 1, p)):
        if all(x % b != 0 for b in smaller):
            print(x)
            sys.exit()
0