Start: Jul, 01, 2019 08:30:00
2019年度暑期短学期第四天
End: Jul, 01, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: G
Result: Accepted
Time: 6ms
Memory: 1756kB
Author: 2018212212201
In contest: 1277

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a>0){
		b=-b;
		if(b>0&&b%2==0){
			a=-a;
		}
		else if(b<0&&b%2!=0){
			a=-a;
		}
	}
	else {//a<=0
		b*=2;
		if(b<0&&b%2==0){
			a=-a;
		}
		else if(b>0&&b%2!=0){
			a=-a;
		}
	}
	printf("%d",a-b);
	
}