Saleh127

codeforces 1360D.cpp

May 25th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. int main()
  6. {
  7. test
  8. {
  9. ll a,c,d,e,f,i,j,k,l;
  10. cin>>a>>c;
  11. d=a;
  12. for(i=1;i*i<=a;i++)
  13. {
  14. if(a%i==0)
  15. {
  16. if(a/i<=c)
  17. {
  18. d=min(d,i);
  19. }
  20. if(i<=c)
  21. {
  22. d=min(d,a/i);
  23. }
  24. }
  25. }
  26. cout<<d<<endl;
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment