Pagini recente » Cod sursa (job #1863235) | Cod sursa (job #1806381) | Cod sursa (job #2595166) | Cod sursa (job #2792987) | Cod sursa (job #705547)
Cod sursa(job #705547)
#include<fstream>
#include<math.h>
using namespace std;
inline int fact(int x){
return (x==1 ? x : x*fact(x-1));
}
int nr_zero_fact(int n){
int q=1,c=1,s=0;
while(q!=0){
q=(int)floor((double)(n/(int)pow((double)5,(double)c)));
s+=q;
c++;
}
return s;
}
int main(){
ifstream in("fact.in");
ofstream out("fact.out");
int p,x=1;
in>>p;
while(nr_zero_fact(x)!=p) x++;
out<<x;
return 0;
}