Cod sursa(job #1030714)
| Utilizator | Data | 15 noiembrie 2013 16:49:42 | |
|---|---|---|---|
| Problema | Dtcsu | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | FMI No Stress 4 | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream input("dtcsu.in");
ofstream output("dtcsu.out");
int main()
{
string s;
for (int i = 0;i<276997;i++)
std::getline(input,s);
int Q;
int p[] = { 2 , 3 , 5 , 7 , 11};
input >> Q;
int nr = 0;
for (int i = 0;i<Q;i++)
{
int x;
input >> x;
for (int j = 0;j<5;j++)
{
while (x > 1 && x % p[j] == 0)
x /= p[j];
}
if (x == 1) nr++;
}
output << nr;
return 0;
}