Pagini recente » Cod sursa (job #1073142) | Cod sursa (job #1996322) | Cod sursa (job #2178589) | Cod sursa (job #2961283) | Cod sursa (job #1032438)
#include<fstream>
#include<algorithm>
#include<string>
using namespace std;
int i,q,sol,l;
long long x,a[7];
string s;
bool este (long long x) {
for (int i=1; i<=5; ++i)
if (x>1) {
long long aux=a[i];
long long pow=aux,pp=aux;
while (x%pow==0) {
pp=pow;
if (pow*pow<x&&x%(pow*pow)==0) pow*=pow; else pow*=aux;
}
x/=pp;
}
if (x==1) return(1); else return(0);
}
long long citeste(){
long long rez=0;
while (s[l]!='\n') { rez=rez*10+int(s[l])-48; ++l; }
++l;
return (rez);
}
int main(void) {
ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");
getline(fin,s,char(EOF)); s+='\n'; l=0;
//for (i=1; i<=276997; ++i) x=citeste();
a[1]=2; a[2]=3; a[3]=5; a[4]=7; a[5]=11;
q=citeste();
for (i=1; i<=q; ++i) {
x=citeste();
if ( este(x) ) ++sol;
}
fout<<sol;
return(0);
}