No.2239 Friday
Problem Statement
Today is Fry Day. On the dining table there are $A$ fried horse mackerels and $B$ fried shrimps.
The plan was to serve them $1$ piece each on a total of $A+B$ plates, but noya-kun mistakenly prepared $A$ plates with a shrimp drawn on them and $B$ plates with a horse mackerel drawn on them.
A plate is called a natural plate if a fried horse mackerel is served on a plate with a horse mackerel drawn on it, or a fried shrimp is served on a plate with a shrimp drawn on it. A plate that is not natural is called an unnatural plate.
If most of the plates are natural and only a few are unnatural, Shobon-san will suspect that the numbers of plates were mistaken. Therefore, noya-kun has decided to serve the food so that the difference between the number of natural plates and the number of unnatural plates is as small as possible.
What is the minimum possible difference between the number of natural plates and the number of unnatural plates?
Constraints
- All inputs are integers.
- $1\le A, B\le 100$
Input
$A$ $B$
Output
Output the minimum possible difference between the number of natural plates and the number of unnatural plates.
Sample
Sample 1
Input
1 2
Output
1
There are $2$ plates with a horse mackerel drawn on them, but there is only $1$ fried horse mackerel. If the fried horse mackerel is served on a plate with a horse mackerel drawn on it, there will be $2$ natural plates and $1$ unnatural plate.
The difference between the number of natural plates and the number of unnatural plates cannot be made smaller than $1$.
Sample 2
Input
2 2
Output
0
It is also possible to make all plates natural, but that is not the goal this time.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2
Nachia