Pagini recente » Cod sursa (job #1105549) | Cod sursa (job #2230931) | Cod sursa (job #578414) | Cod sursa (job #2277043) | Cod sursa (job #672607)
Cod sursa(job #672607)
#include<iostream>
#include<fstream>
using namespace std;
ifstream ifile;
ofstream ofile;
int i,c2=0,c5=0,n;
int count2(int x){
if(x%2==0 && x>=2) return 1 + count2(x/2);
else return 0;
}
int count5(int x){
if(x%5==0 && x>=5) return 1 + count5(x/5);
else return 0;
}
int main(){
ifile.open("fact.in");
ofile.open("fact.out");
ifile>>n;
//cin>>n;
i=0;
while(c2<n || c5<n){
i++;
c2 += count2(i);
c5 += count5(i);
}
ofile<<i;
//cout<<i;
ifile.close();
ofile.close();
//system("PAUSE");
return 0;
}