Cod sursa(job #1031789)

Utilizator tibi9876Marin Tiberiu tibi9876 Data 15 noiembrie 2013 18:25:40
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.43 kb
#include<fstream>
#include<string>
using namespace std;

string s;
int i,n,x,nr;

int main()
{
	ifstream f("dtcsu.in");
	ofstream g("dtcsu.out");
	for (i=1;i<=276997;i++)
		getline(f,s);
	f >> n;
	for (i=1;i<=n;i++)
	{
		f >> 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)
			nr++;
	}
	g << nr;
	return 0;
}