Start: Jun, 28, 2019 13:00:00
2019年度暑期短学期第四天-助教场
End: Jun, 30, 2019 23:59:00
Time elapsed:
Time remaining:

Problem_ID: G
Result: Accepted
Time: 7ms
Memory: 1712kB
Author: 2018212212059
In contest: 1289

#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <deque>
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long

using namespace std;

const int maxn=1e3+10;
int a,b;

int main()
{
	cin>>a>>b;
	if(a>0)b=-b;
	else b*=2;
	int fa=-1,fb=-1;
	if(a>=0)fa=1;
	if(b>=0)fb=1;
	if(b%2)
	{
		if(fa!=fb)a*=(-1);
	}
	else 
	{
		if(fa==fb)a*=(-1);
	}
	printf("%d\n",a-b);
}