Pagini recente » Cod sursa (job #1085708) | Cod sursa (job #2126564) | Cod sursa (job #2953345) | Cod sursa (job #2836150) | Cod sursa (job #874214)
Cod sursa(job #874214)
#include<cstdio>
#include<cmath>
#define N 250000000
#define ULL unsigned long long
using namespace std;
ULL n,i,x;
int main()
{
freopen("pitagora2.in","r",stdin);
freopen("pitagora2.out","w",stdout);
scanf("%d",&n);
x=n*n;
for(i=1;i<=x*2;i++)
if(sqrt(i*i+x)==(ULL)sqrt(i*i+x))
if(n+i>(ULL)sqrt(i*i+x))
break;
if(i>N)
printf("-1\n");
else
printf("%lld\n",i);
return 0;
}