Pagini recente » Cod sursa (job #1397776) | Cod sursa (job #763728) | Cod sursa (job #2744864) | Cod sursa (job #1700713) | Cod sursa (job #1030567)
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#define pii pair <int, int>
#define pdd pair <double, double>
#define vi vector <int>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define ll long long
#define NMAX (1 << 16)
using namespace std;
ll n, x;
char buff[NMAX];
int pos, m, res;
void read_ll(ll &x)
{
x = 0;
while (!isdigit(buff[pos]))
if (++pos == NMAX)
fread(buff, 1, NMAX, stdin), pos = 0;
while (isdigit(buff[pos]))
{
x = x * 10 + buff[pos] - '0';
if (++pos == NMAX)
fread(buff, 1, NMAX, stdin), pos = 0;
}
}
void read_int(int &x)
{
x = 0;
while (!isdigit(buff[pos]))
if (++pos == NMAX)
fread(buff, 1, NMAX, stdin), pos = 0;
while (isdigit(buff[pos]))
{
x = x * 10 + buff[pos] - '0';
if (++pos == NMAX)
fread(buff, 1, NMAX, stdin), pos = 0;
}
}
int main()
{
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
//freopen("input", "r", stdin);
int i;
for (i = 1; i <= 276997; i++)
read_ll(x);
read_int(m);
for (i = 1; i <= m; i++)
{
read_ll(x);
while (x % 2 == 0) x /= 2;
while (x % 3 == 0) x /= 3;
while (x % 5 == 0) x /= 5;
while (x % 7 == 0) x /= 7;
while (x % 11 == 0) x /= 11;
if (x == 1)
res++;
}
printf("%d\n", res);
return 0;
}