Pagini recente » Cod sursa (job #1168159) | Cod sursa (job #99974) | Cod sursa (job #2630550) | Cod sursa (job #2507640) | Cod sursa (job #473753)
Cod sursa(job #473753)
#include <fstream>
#include <iostream>
#include <stdio.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
long p;
int x = 0,y = 0,z,t = 0;
f >> p;
for (int i = 1 ; i < 32000 ; i++ )
{
z = i;
while ( z % 2 == 0 )
{
x++;
z = z / 2;
}
z = i;
while ( z % 5 == 0 )
{
y++;
z = z / 5;
}
if ((x < y) && (x == p ))
{
g << i ;
break;
t = 1;
}
if ((x > y) && (y == p ))
{
g << i ;
break;
t = 1;
}
}
it (t==0) {
g << "-1";
}
return 0;
}