Pagini recente » Cod sursa (job #2153135) | Cod sursa (job #1606737) | Cod sursa (job #2960782) | Cod sursa (job #1144476) | Cod sursa (job #705546)
Cod sursa(job #705546)
#include<fstream>
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;
}