Cod sursa(job #624478)

Utilizator Marin7ygsepoywepoj Marin7 Data 22 octombrie 2011 13:54:58
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.37 kb
#include <fstream>
using namespace std;

ifstream f("fact.in");
ofstream g("fact.out");

int main()
{
	long long p;
	int i=0,ct=0;
	f>>p;
	if (p==0)
		g<<1;
	else
	{
		while (ct<p)
		{
			i+=5;
			ct++;
			if (i%25==0 || i%100==0)
				ct++;
			if (i%125==0 || i%10000==0)
				ct++;
			if (i%625==0 || i%100000000==0)
				ct++;
		}
		g<<i;
	}

}