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: 3ms
Memory: 1756kB
Author: 2018212212127
In contest: 1289

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
const int maxn=1e2+10;
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>0) b=-b;
	else b*=2;
	if(abs(b)&1){
		if(b<0) a=-abs(a);
		else a=abs(a);
	}
	else{
		if(b<0) a=abs(a);
		else a=-abs(a);
	}
	printf("%d\n",a-b);
}