結果

問題 No.3253 Banned Product
ユーザー lif4635
提出日時 2025-09-04 03:15:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,352 KB
実行使用メモリ 66,860 KB
最終ジャッジ日時 2025-09-05 05:29:14
合計ジャッジ時間 1,345 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

def solve():
    n, k = map(int, input().split())
    while k <= n:
        for d in range(1, isqrt(n)+1):
            if n%d==0 and d <= k and n//d <= k:
                break
        else:
            print(n)
            return
        n -= 1
    print(-1)
    return 

t = int(input())
for i in range(t):
    solve()
0