You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
677 B
C++

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int a,x,y;
scanf("%d%d%d",&a,&x,&y);
if(y%a==0)
return puts("-1"),0;
int l=y/a;
if(l==0)
puts((((x*2)>-a)&&((x*2)<a))?"1":"-1");
else
{
if(l&1)
{
if(((x*2)>-a)&&((x*2)<a))
return printf("%d",l/2*3+2),0;
else
return puts("-1"),0;
}
else
{
if((x<=-a)||(x>=a)||x==0)
return puts("-1"),0;
else
return printf("%d",l/2*3+(x>0)),0;
}
}
return 0;
}