Advertisement
bappi2097

S - Odd Numbers of Divisors

Sep 9th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4. vector<ll> divisors[1000005];
  5. int mark[10000]={0};
  6. void Divisor(ll n)
  7. {
  8.     for(ll i=1;i<=n;i++)
  9.     {
  10.         for(ll j=i;j<=n;j+=i)divisors[j].push_back(i);
  11.     }
  12.     return;
  13. }
  14. int main()
  15. {
  16.     ios_base::sync_with_stdio(false);
  17.     cin.tie(NULL);
  18.     #ifndef ONLINE_JUDGE
  19.     freopen("input.cpp","r",stdin);
  20.     #endif // ONLINE_JUDGE
  21.     Divisor(1000000);
  22.     for(int i=1;i<=1000000;i++)
  23.     {
  24.         if(divisors[i].size()%2==1)
  25.         {
  26.             //cout<<i<<" : "<<divisors[i].size()<<endl;
  27.             mark[divisors[i].size()]++;
  28.         }
  29.     }
  30.     for(int i=0;i<=10000;i++)if(mark[i])cout<<i<<" : "<<mark[i]<<endl;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement