Pagini recente » Cod sursa (job #2113711) | Cod sursa (job #2739477) | Cod sursa (job #331622) | Cod sursa (job #770154) | Cod sursa (job #2622336)
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
int long long p,n,aux=1,ok=0,gasit=0;
f>>p;
for(int i=1;i<=p;i++)
aux*=10;
cout<<aux<<endl;
n=1;
int x=2;
while(ok==0)
{
if(n%aux==0 && n%(aux*10)!=0)
{
ok=1;
}
else
{n=n*x;
x++;
}
if(n<0) { gasit=1;break;}
}
if(gasit==1) g<<"-1";
else g<<x-1;
}