Cod sursa(job #413078)
Utilizator | Data | 7 martie 2010 17:00:57 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<iostream.h>
#include<fstream.h>
int main()
{
long long int p,i,x=0,n;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
if(p==0) cout<<"1";
else {for(i=1;x<p;i++) if(i%5==0) {n=i;while(n%5==0) {x++;n=n/5;}}
fout<<i-1;}
fin.close();
fout.close();
return 0;}