Cod sursa(job #592585)
| Utilizator | Data | 29 mai 2011 11:20:20 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream.h>
#include <fstream.h>
ifstream fin("fact.in");
ofstream fout("fact.out");
int zero(int x)
{
int nrzero=0;
while (x%10==0)
{
nrzero=nrzero+1;
x=x/10;
}
return nrzero;
}
int main()
{
long p,fact=1;
int n=1,ok=1;
fin>>p;
while (ok==1)
{
fact=fact*n;
n=n+1;
if (zero(fact)==p) ok=0;
else ok=1;
}
fout<<n;
return 0;
fout.close();
}