Pagini recente » Cod sursa (job #2937489) | Cod sursa (job #1377635) | Cod sursa (job #2258013) | Cod sursa (job #2662751) | Cod sursa (job #1035074)
#include <fstream>
#include <stdio.h>
#include <climits>
#include <algorithm>
#define Nmax 276997
using namespace std;
//ifstream f("dtcsu.in");
//ofstream g("dtcsu.out");
int Q,sol;
long long N,x,Pow[15][100];
int P[5]={2,3,5,7,11};
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
for(int i=1;i<=Nmax;++i)scanf("%lld\n",&N);
for(int i=0;i<=4;++i)
{
Pow[P[i]][0]=1;
int j=0;
while(1LL*Pow[P[i]][j]*P[i]<=ULLONG_MAX)Pow[P[i]][++j]=Pow[P[i]][j-1]*P[i];
}
//f>>Q;
scanf("%d\n",&Q);
for(int i=1;i<=Q;++i)
{
long long N;
//f>>N;
scanf("%d\n",&N);
int j=0;
while(N % Pow[2][j]==0)++j;
--j;
N/=Pow[2][j];
j=0;
while(N % Pow[3][j]==0)++j;
--j;
N/=Pow[3][j];
j=0;
while(N % Pow[5][j]==0)++j;
--j;
N/=Pow[5][j];
j=0;
while(N % Pow[7][j]==0)++j;
--j;
N/=Pow[7][j];
j=0;
while(N % Pow[11][j]==0)++j;
--j;
N/=Pow[11][j];
if(N==1)++sol;
}
printf("%d\n",sol);
//g<<sol<<'\n';
//f.close();g.close();
return 0;
}