Pagini recente » Cod sursa (job #611574) | Cod sursa (job #279708) | Cod sursa (job #2584400) | Cod sursa (job #674211) | Cod sursa (job #656615)
Cod sursa(job #656615)
#include<iostream>
#include<fstream>
using namespace std;
std::ifstream f("fact.in");
std::ofstream g("fact.out");
int main(void){
long int x=1,i=2,p,j;
f>>p;
if(p==0)
g<<1;
else if(p%2==1)
g<<-1;
else
{
bool go=true;
while(go)
{
//imultim
x=x*i;
j=0;
int x2=x;
while(x2%10 == 0)
{
j++;
x2=x2/10;
}
if(j==p)
go=false;
else
i++;
}
g<<i;
}
return 0;
}