Cod sursa(job #263906)
Utilizator | Data | 20 februarie 2009 22:24:04 | |
---|---|---|---|
Problema | Factorial | Scor | 85 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<fstream>
using namespace std;
int main()
{
long p,i,x=0;
ifstream in("fact.in");
ofstream out("fact.out");
in>>p;
while (p/35!=0)
{x=x+125;
i=x;
p=p-28;
while (i%5==0)
{i=i/5;
p--;}}
while (p/5!=0)
{x=x+25;
i=x;
p=p-4;
while (i%5==0)
{i=i/5;
p--;}}
x=x+p*5;
out<<x;
in.close();
out.close();
return 0;
}