結果

問題 No.3253 Banned Product
コンテスト
ユーザー me
提出日時 2026-09-13 18:38:28
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 88 ms / 2,000 ms
+ 642µs
コード長 398 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 59 ms
コンパイル使用メモリ 15,232 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-09-13 18:38:40
合計ジャッジ時間 1,772 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve(x):
    for a in range(1, int(x ** 0.5) + 1):
        if x % a:
            continue
        if a <= k and x / a <= k:
            return False
    return True

t = int(input())
for _ in range(t):
    n, k = map(int, input().split())
    ans = []
    for x in range(n, max(0, n - 282), -1):
        if solve(x):
            print(x)
            break
    else:
        print(-1)
        
0