Pagini recente » Cod sursa (job #166434) | Cod sursa (job #56145) | Cod sursa (job #2728769) | Cod sursa (job #2932094) | Cod sursa (job #2135442)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f ("fact.in");
ofstream g ("fact.out");
int main()
{
int k=0, k2=0, k5=0, i=0, x, p,q, y;
f>>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;}
g<<i;
return 0;
}