結果

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

ソースコード

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 >= 1) {
        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