Cod sursa(job #2188528)
Utilizator | Data | 27 martie 2018 10:48:15 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | bpc9 | Marime | 0.46 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;
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;
}