問題一覧 > 通常問題

No.2239 Friday

レベル : / AI推定難易度 : 400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 195
作問者 : noya2 / テスター : shobonvip 👑 Nachia
お気に入りにしたユーザー ProblemId : 9326 / 自分の提出
問題文最終更新日: 2023-03-10 01:28:05
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 380 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。