Saleh127

Untitled

May 11th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long t,ans,c,divs,l,u,num,i,j,k;
  6. cin>>t;
  7. while(t--)
  8. {
  9. cin>>l>>u;
  10. ans=0;
  11. for(i=l;i<=u;i++)
  12. {
  13. divs=0;
  14. for(j=1;j*j<=i;j++)
  15. {
  16. if(i%j==0)
  17. {
  18. if(j*j==i) divs++;
  19. else divs+=2;
  20. }
  21. }
  22. if(divs>ans)
  23. {
  24. ans=divs;
  25. num=i;
  26. }
  27. }
  28. printf("Between %lld and %lld, %lld has a maximum of %lld divisors.\n",l,u,num,ans);
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment