Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <math.h>
- #include<string>
- #define pi acos(-1.0)
- #define ll long long int
- using namespace std;
- int main() {
- ll t;
- cin >> t;
- while(t--) {
- ll a, b, n=0, nd=0;
- double f=0, c=0;
- cin >> a >> b;
- for(int i=a; i<=b; i++) {
- c=0;
- f=pow(i,0.5);
- for(int j=1; j<=f; j++) {
- if(i%j==0){
- c++;
- if(j<f) c++;
- }
- }
- if(c>nd) {
- nd=(int)c;
- n=i;
- }
- }
- cout << "Between " << a << " and " << b << ", " << n << " has a maximum of " << nd << " divisors.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement