About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

মঙ্গলবার, ৮ এপ্রিল, ২০১৪

UVA : 294 - Divisors

#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;
}

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

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