Start: Jun, 05, 2019 17:00:00
2019春ACM通识课考试(第三场)
End: Jun, 05, 2019 20:15:00
Time elapsed:
Time remaining:

Problem_ID: B
Result: Accepted
Time: 6ms
Memory: 1712kB
Author: 2018212212028
In contest: 1272

#include<algorithm>
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;

int main ()
{
	int x,y;
	cin>>x>>y;
	if(x>0)
	{
		y=-y;
	}
	else
	{
		y*=2;
	}
	if(abs(y)%2==1)
	{
		if(x*y<0)
		{
			x=-x;
		}
		
	}
	else if(abs(y)%2==0)
	{
		if(x*y>0)
		{
			x=-x;
		}
	}
	cout<<x-y;
}