結果

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

ソースコード

diff #

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

void solve(){
  using ll=long long;
  ll n,k;
  cin>>n>>k;
  auto check=[&](ll x){
    for (ll i=1;i*i<=x&&i<=k;i++){
      if (x%i==0&&x/i<=k) return false;
    }
    return true;
  };
  for (ll x=n;x>=k;x--){
    if (check(x)){
      cout<<x<<endl;
      return;
    }
  }
  cout<<-1<<endl;
}

int main(){
  int t;
  cin>>t;
  while (t--) solve();
}
0