結果
| 問題 |
No.3253 Banned Product
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 23:12:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 663 bytes |
| コンパイル時間 | 267 ms |
| コンパイル使用メモリ | 82,644 KB |
| 実行使用メモリ | 68,412 KB |
| 最終ジャッジ日時 | 2025-09-05 23:13:00 |
| 合計ジャッジ時間 | 4,021 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 2 TLE * 1 -- * 5 |
ソースコード
def getPrimes(last: int, first: int = 1):
if last < first:
last, first = first, last
isPrime = [True] * (last + 1)
isPrime[0] = isPrime[1] = False
for i in range(2, int(last ** 0.5 + 1)):
if isPrime[i]:
for j in range(i ** 2, last + 1, i):
isPrime[j] = False
return [i for i in range(first, last + 1) if isPrime[i]]
primes=set(getPrimes(int((10**9)**0.5)+1))
T=int(input())
for _ in range(T):
N,K=map(int,input().split())
if K==N:
print(-1)
else:
ans=0
for i in range(N,K,-1):
if i in primes:
ans=max(ans,i*(N//i))
print(ans)