Cod sursa(job #1522373)
Utilizator | Data | 11 noiembrie 2015 17:06:17 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int P,N=1,nr5=0,CN=1;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>P;
if(P==0)
{
fout<<1;
return 0;
}
while(P!=nr5)
{
while(CN%5==0)
{
nr5++;
CN=CN/5;
}
N++;
CN=N;
}
fout<<N-1;
cout<<N-1;
return 0;
}