Pagini recente » Cod sursa (job #1491278) | Cod sursa (job #1600058) | Cod sursa (job #445604) | Cod sursa (job #2510352) | Cod sursa (job #2577950)
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p, n, cnt2, cnt5;
bool ok=1;
int cnt=2, copcnt;
int main()
{
fin>>p;
if(p==0){
fout<<1;
return 0;
}
while(ok){
copcnt=cnt;
while(copcnt){
while(copcnt%2==0){
copcnt/=2;
cnt2++;
}
while(copcnt%5==0){
copcnt/=5;
cnt5++;
}
copcnt=0;
}
if(min(cnt2, cnt5)==p){
fout<<cnt;
ok=0;
return 0;
}
cnt++;
}
return 0;
}