Pagini recente » Cod sursa (job #2729153) | Cod sursa (job #1258924) | Cod sursa (job #2574954) | Cod sursa (job #1309360) | Cod sursa (job #1031971)
#include <cstdio>
using namespace std;
char ch[500000];
inline void Read(long long &x)
{
x = 0;
for (int i = 0; ch[i]; ++i)
x = x*10LL + ch[i] - '0';
}
inline bool Good(long long nr)
{
if (nr == 0)
return false;
while ((nr & 1LL) == 0)
nr >>= 1LL;
while (nr % 3LL == 0)
nr /= 3LL;
while (nr % 5LL == 0)
nr /= 5LL;
while (nr % 7LL == 0)
nr /= 7LL;
while (nr % 11LL == 0)
nr /= 11LL;
if (nr == 1)
return true;
return false;
}
int main()
{
freopen("dtcsu.in", "r", stdin);
for (int i = 1; i<=276997; ++i)
gets(ch);
gets(ch);
int ans = 0;
int Q;
long long QL;
long long x;
Read(QL);
Q = QL;
while (Q--)
{
gets(ch);
Read(x);
if (Good(x))
++ans;
}
FILE *g = fopen("dtcsu.out", "w");
fprintf(g, "%d\n", ans);
fclose(g);
return 0;
}