Cod sursa(job #1181842)
Utilizator | Data | 3 mai 2014 22:47:23 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f;
ofstream g;
long int n,p,t[10000],i,k;
main()
{
f.open("fact.in");
g.open("fact.out");
f>>p;
p=p*5;
t[0]=5;
i=0;
while(t[i]<p)
{
i++;
t[i]=5*t[i-1];
if(t[i]<p)p=p-5;
}
if(p==0)g<<1;
else g<<p;
g.close();
}