fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int MAXN = 20005;
  5. vector<int>divisors[MAXN+5];
  6.  
  7. int main(void) {
  8.  
  9. for(int i=1;i<=MAXN;i++)
  10. {
  11. for(int j=i;j<=MAXN;j+=i)
  12. {
  13. divisors[j].push_back(i);
  14. }
  15. }
  16.  
  17. int max_divisors = 0;
  18. for(int j=1;j<=MAXN;j++)
  19. max_divisors = max( max_divisors, (int)divisors[j].size() );
  20.  
  21. cout<<"Maximum number of divisors of numbers upto "<<MAXN<<" are "<<max_divisors<<endl;
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
Maximum number of divisors of numbers upto 20005 are 80