結果

問題 No.3253 Banned Product
ユーザー rabimea
提出日時 2025-09-25 05:29:36
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 652 ms / 2,000 ms
コード長 623 bytes
コンパイル時間 2,845 ms
コンパイル使用メモリ 275,320 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-25 05:29:41
合計ジャッジ時間 4,894 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>

using std::cin, std::cout, std::cerr;
using ll = long long;

ll Solve(ll n, ll k) {
    while(n > k) {
        bool ok = true;
        for(ll i = 1; i <= k && i * i <= n; i ++)
            if(n % i == 0 && n / i <= k)
                ok = false;
        if(ok) return n;
        n --;
    }
    return -1;
}

int main() {
    std::ios::sync_with_stdio(false);
    int T; cin >> T;
    while(T --) {
        ll n, k;
        cin >> n >> k;
        cout << Solve(n, k) << '\n';
    }
}
0