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: 4ms
Memory: 2540kB
Author: 2018212212317
In contest: 1289

#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
const int maxn = 100010;
const int inf = 0x3f3f3f3f;
const int modu = 1e9+7;
int n,m,k,t,sum,ans;
int x,y,z,w;
int a[maxn],b[maxn];
string s;
int main(){
	cin>>n>>m;
	if(n>0) m=-m;
	else m*=2;
	if(m%2==0) {
		if(m>0&&n>0) n=-n;
		if(m<0&&n<0) n=-n;
	}
	else{
		if(m>0&&n<0) n=-n;
		if(m<0&&n>0) n=-n;
	}
	cout<<n-m<<endl;
}