রবিবার, ২৮ আগস্ট, ২০১৬

UVA 294 - Divisors

#include<stdio.h>
#include<math.h>
main()
{
long int i,c;
scanf("%ld",&c);
for(i=1;i<=c;i++)
{
long long int j,a,b,count=0,max=0,str;
scanf("%lld%lld",&a,&b);
for(j=a;j<=b;j++)
{
long kk,k=sqrt(j);
for(kk=1;kk<=k;kk++)
{
if(j%kk==0)
{
if(j/kk!=kk)count++;
count++;
}
}
if(count>max)
{
max=count;
str=j;
}
count=0;
}
printf("Between %lld and %lld, %lld has a maximum of %lld divisors.\n",a,b,str,max);
}
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন

Factory Pattern

Factory Method  is a creational design pattern that provides an interface for creating objects in a superclass but allows subclasses to alte...