結果
問題 |
No.3253 Banned Product
|
ユーザー |
|
提出日時 | 2025-09-05 21:25:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 1,847 ms |
コンパイル使用メモリ | 194,480 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-05 21:25:25 |
合計ジャッジ時間 | 2,447 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while(T--){ int N,K; cin >> N >> K; auto f = [&](int x) -> bool { for(int i=1; i*i<=x; i++) if(x%i == 0){ int a = i,b = x/i; if(max(a,b) <= K) return false; } return true; }; for(int i=N; i>=K; i--){ if(i == K){cout << -1 << "\n"; break;} if(f(i)){cout << i << "\n"; break;} } } }