結果

問題 No.371 ぼく悪いプライムじゃないよ
ユーザー T1610T1610
提出日時 2018-02-15 15:20:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 14,044 KB
最終ジャッジ日時 2023-08-26 21:52:20
合計ジャッジ時間 8,257 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
13,532 KB
testcase_01 AC 63 ms
9,096 KB
testcase_02 WA -
testcase_03 AC 63 ms
9,304 KB
testcase_04 AC 64 ms
9,112 KB
testcase_05 AC 64 ms
9,072 KB
testcase_06 WA -
testcase_07 AC 65 ms
9,076 KB
testcase_08 AC 64 ms
9,268 KB
testcase_09 AC 65 ms
9,180 KB
testcase_10 AC 65 ms
9,104 KB
testcase_11 AC 64 ms
9,072 KB
testcase_12 AC 64 ms
9,152 KB
testcase_13 AC 67 ms
9,148 KB
testcase_14 AC 67 ms
9,096 KB
testcase_15 AC 67 ms
9,304 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 64 ms
9,004 KB
testcase_19 AC 64 ms
9,104 KB
testcase_20 AC 128 ms
9,104 KB
testcase_21 AC 103 ms
9,240 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
MAX_PRIME = 100000+10
isPrime = [1 for i in range(MAX_PRIME)]
primes = []
isPrime[0] = 0
isPrime[1] = 0
for i in range(2, MAX_PRIME) :
    if isPrime[i] == 1:
        for j in range(i + i, MAX_PRIME, i) :
            isPrime[j] = 0
        primes.append(i)
L, H = list(map(int, input().split()))
minPrimes = -1
ans = -1
SZ = len(primes)
for i in range(SZ) :
    for j in range(i+1) :
        k = primes[i] * primes[j]
        if L <= k <= H :
            tmp = primes[j]
            if minPrimes < tmp :
                minPrimes = tmp
                ans = k
            elif minPrimes == tmp :
                ans = max(ans, k)
        elif k > H :
            break
print(ans)
0