Pagini recente » Cod sursa (job #645412) | Cod sursa (job #1937788) | Cod sursa (job #898101) | Cod sursa (job #502174) | Cod sursa (job #2135431)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("factorial.in");
ofstream g ("factorial.out");
int main()
{
int k=0, k2=0, k5=0, i=0, x, p,q, y;
cin>>p;
while (1>0)
{
i++; x=i;
while(x%10==0)
{
k++; x=x/10;
} y=x;
while(x%2==0)
{
k2++; x=x/2;
}
x=y;
while(x%5==0)
{
k5++; x=x/5;
}
if(k2>k5) q=k5;
else q=k2;
if(q+k==p) break;}
cout<<i;
return 0;
}