Cod sursa(job #671824)
Utilizator | Data | 31 ianuarie 2012 22:00:45 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.24 kb |
#include<fstream>
using namespace std;
int main()
{unsigned long long int p, i;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
f.close();
if(p==0)
g<<1;
else
{for(i=5;i<p;i*=5)
p-=(p-1)/i;
g<<5*p;}
g.close();
return 0;
}