Cod sursa(job #1393345)
Utilizator | Data | 19 martie 2015 12:29:31 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long x,p,e=25,a;
int main()
{
f>>p;
if(p==0)
g<<1;
else
{
x=p*5;
while(e<=x)
{
x-=((x-1)/e)*5;
e*=5;
}
g<<x;
}
return 0;
}