#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
long long divisor(long long num){
int j,count=0;
for(j=1;j<=sqrt(num);j++){
if(num%j==0){
if(num/j!=j)count+=2;
else count++;
}
}
return count;
}
int main (){
long long x,i,l,u,test,big,div;
cin>>test;
while(test--){
cin>>l>>u;
if(l==1&&u==0){
cout<<"Between "<<l<<" and "<<u<<", "<<1<<" has a maximum of "<<1<<" divisors."<<endl;
}
else {
div=0;
for(i=l;i<=u;i++){
x=divisor(i);
if(x>div){
big=i;
div=x;
}
}
cout<<"Between "<<l<<" and "<<u<<", "<<big<<" has a maximum of "<<div<<" divisors."<<endl;
}
}
return 0;
}
#include <cstdio>
#include <math.h>
using namespace std;
long long divisor(long long num){
int j,count=0;
for(j=1;j<=sqrt(num);j++){
if(num%j==0){
if(num/j!=j)count+=2;
else count++;
}
}
return count;
}
int main (){
long long x,i,l,u,test,big,div;
cin>>test;
while(test--){
cin>>l>>u;
if(l==1&&u==0){
cout<<"Between "<<l<<" and "<<u<<", "<<1<<" has a maximum of "<<1<<" divisors."<<endl;
}
else {
div=0;
for(i=l;i<=u;i++){
x=divisor(i);
if(x>div){
big=i;
div=x;
}
}
cout<<"Between "<<l<<" and "<<u<<", "<<big<<" has a maximum of "<<div<<" divisors."<<endl;
}
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন