Cod sursa(job #1446623)
Utilizator | Data | 2 iunie 2015 13:29:31 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
int p,c,f,ff,stillgoing,nr;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
fin >> p;c=2;f=1;
stillgoing=1;
while (stillgoing)
{
if (p==0){f=1;break;}
f*=c;
c++;
ff=f;
while (ff%10==0){ff/=10;nr++;}
if (nr==p)break;
nr=0;
}
fout << c-1;
fin.close();
fout.close();
return 0;
}