SHARE
TWEET

Fantastice

As932 Dec 7th, 2019 (edited) 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("fantastice.in");
  5. ofstream fout("fantastice.out");
  6. int vec[2000002];
  7. int main()
  8. {
  9.     int n,x,nrdiv,p,c=0;fin>>n;
  10.     int nr=1000000;
  11.     vec[0]=1,vec[1]=1;
  12.     for(int i=2;i<=nr;i++)vec[i]=0;
  13.  
  14.     for(int i=2;i*i<=nr;i++)
  15.         if(vec[i]==0)
  16.         for(int j=2;j<=nr/i;j++)
  17.         vec[i*j]=1;
  18.  
  19.     for(int i=1;i<=n;i++)
  20.     {
  21.         fin>>x;
  22.         nrdiv=1;
  23.         for(int i=2;i<=x;i++)
  24.             if(vec[i]==0)
  25.             {
  26.                 p=0;
  27.                 while(x%i==0)
  28.                     {p++;x/=i;}
  29.                 nrdiv*=(p+1);
  30.             }
  31.         if(vec[nrdiv]==0)c++;
  32.     }
  33.     fout<<c;
  34.     return 0;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top