Cod sursa(job #2188544)
Utilizator | Data | 27 martie 2018 10:59:20 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | bpc9 | Marime | 0.51 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
int p, a=5,ca, nrDe5=0;
fin>>p;
if (p == 0)
fout<<1;
else{
while(nrDe5<=p){
ca=a;
while(ca%5==0){
ca=ca/5;
nrDe5++;
if(nrDe5==p) break;
}
if(nrDe5==p) break;
a++;
}
fout<<a;
}
fin.close();
fout.close();
return 0;
}