Cod sursa(job #263083)
Utilizator | Data | 19 februarie 2009 21:43:00 | |
---|---|---|---|
Problema | Factorial | Scor | 65 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 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/5!=0)
{x=x+25;
i=x;
p=p-4;
while (i%5==0)
{i=i/5;
p--;}}
if (p>=0) x=x+p*5;
out<<x;
in.close();
out.close();
return 0;
}