cosenza987

adssd

Mar 15th, 2021
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. #include <stdio.h>
  4. #include <math.h>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8. set<long long> bruh;
  9.  
  10. int main() {
  11.     long long t,i,n,k,j;
  12.     scanf("%lld",&t);
  13.     for(i=0;i<t;i++) {
  14.         bruh.clear();
  15.         scanf("%lld %lld",&n,&k);
  16.         if(k >= n) {
  17.             printf("1\n");
  18.         } else {
  19.             for(j=1;j*j<=n;j++) {
  20.                 if(n%j == 0 && n/j <= k) {
  21.                     printf("%lld\n",j);
  22.                     bruh.insert(j);
  23.                     break;
  24.                 }
  25.             }
  26.             if(bruh.size() == 0) {
  27.                 printf("%lld\n",n);
  28.             }
  29.         }
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment