Cod sursa(job #2196118)
Utilizator | Data | 18 aprilie 2018 15:16:37 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <fstream>
using namespace std;
int p,e,i,sol;
int main (){
ifstream fin ("fact.in");
ofstream fout ("fact.out");
fin>>p;
if (p==0){
fout<<1;
return 0;
}
i=1;
while (sol!=p){
e=i;
while (e%5==0){
sol++;
e/=5;
}
i++;
}
fout<<i-1;
}