結果
| 問題 | No.3253 Banned Product |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-09-06 13:41:05 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| + 904µs | |
| コード長 | 714 bytes |
| 記録 | |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 52,432 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-14 19:24:34 |
| 合計ジャッジ時間 | 1,144 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3253.cc: No.3253 Banned Product - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
using ll = long long;
/* global variables */
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int n, k;
scanf("%d%d", &n, &k);
if (n > (ll)k * k) { printf("%d\n", n); continue; }
int minn = max(2, n - 281);
for (; n >= minn; n--) {
bool ok = true;
for (int p = 1; p <= k && p * p <= n; p++)
if (n % p == 0) {
int q = n / p;
if (q <= k) { ok = false; break; }
}
if (ok) break;
}
printf("%d\n", (n >= minn) ? n : -1);
}
return 0;
}
tnakao0123