Cod sursa(job #2239204)
Utilizator | Data | 9 septembrie 2018 22:48:40 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
int main()
{int N, P, i, zero, F ;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>P;
if(P==0)
fout<<1;
N=4;
while(P!=zero)
{N++; F=1; zero=0;
for(i=2; i<=N; i++)
F=F*i;
while((F/10)*10==F)
{ F=F/10;
zero++;
}
}
fout<<N;
return 0;
}