結果
| 問題 |
No.3253 Banned Product
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-09-08 19:59:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 957 ms / 2,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 299 ms |
| コンパイル使用メモリ | 82,360 KB |
| 実行使用メモリ | 70,400 KB |
| 最終ジャッジ日時 | 2025-09-08 19:59:12 |
| 合計ジャッジ時間 | 3,818 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
def divisors(n: int) -> list[int]:
"""n の約数を求める"""
s = set()
p = 1
while p * p <= n:
if n % p == 0:
s.add(p)
s.add(n // p)
p += 1
return sorted(s)
def solve():
N, K = map(int, input().split())
for x in reversed(range(max(1, N-281), N+1)):
ok = True
for d in divisors(x):
a = d
b = x // d
if a <= K and b <= K:
ok = False
break
if ok:
return x
return -1
T = int(input())
for _ in range(T):
ans = solve()
print(ans)
norioc