結果

問題 No.3253 Banned Product
ユーザー forest3
提出日時 2025-09-25 18:12:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 606 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 1,398 ms
コンパイル使用メモリ 162,852 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-25 18:12:24
合計ジャッジ時間 3,421 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
using ll = long long;

int main(){
	int t;
	cin >> t;
	rep(ti, 0, t) {
		int n, k, ex = 0;
		cin >> n >> k;
		for(int x = n; x > k; x--) {
			int f = 0;
			for(ll a = 1; a * a <= x && a <= k; a++) {
				if(x % a) continue;
				int b = n / a;
				if(b <= k) {
					f = 1;
					continue;
				}
			}
			if(f == 0) {
				cout << x << endl;
				ex = 1;
				break;
			}
		}
		if(ex == 0) cout << -1 << endl;
	}
}
0