Cod sursa(job #724158)
Utilizator | Data | 26 martie 2012 11:59:51 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.26 kb |
#include<fstream>
using namespace std;
int main()
{
unsigned long long a,p=25;
ifstream in("fact.in");
ofstream out("fact.out");
in>>a;
if(a==0)
out<<1;
else{
a*=5;
while(p<a)
{
a-=((a/p-1)*5);
p*=5;
}
out<<a;}
return 0;
}