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: 8ms
Memory: 1092kB
Author: 2018211401064
In contest: 1272

#include<stdio.h>
#include<stdlib.h>
int f(int x)
{
	if(x>=0)
	{
		return 1;
	}
	else
	{
		return -1;
	}
}
int main()
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a>0)
	{
		b=-b;
	}
	else
	{
		b=2*b;
	}
	if(abs(b)%2==1)
	{
		a=abs(a)*f(b);
	}
	else
	{
		a=-(abs(a)*f(b)); 
	}
	printf("%d",a-b);
	return 0; 
}