AtCoder Grand Contest 008
A
Simple Calculator
AtCoder
⌀ 740
原题
←B →
翻译中…

Problem Statement

翻译中…

Snuke has a calculator. It has a display and two buttons.

翻译中…

Initially, the display shows an integer $x$. Snuke wants to change this value into another integer $y$, by pressing the following two buttons some number of times in arbitrary order:

翻译中…
  • Button A: When pressed, the value on the display is incremented by $1$.
  • Button B: When pressed, the sign of the value on the display is reversed.
翻译中…

Find the minimum number of times Snuke needs to press the buttons to achieve his objective. It can be shown that the objective is always achievable regardless of the values of the integers $x$ and $y$.

翻译中…

Constraints

翻译中…
  • $x$ and $y$ are integers.
  • $|x|, |y| ≤ 10^9$
  • $x$ and $y$ are different.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

x y

翻译中…

Output

翻译中…

Print the minimum number of times Snuke needs to press the buttons to achieve his objective.

翻译中…

样例

Input #1
10 20
Output #1
10
Press button A ten times.
Input #2
10 -10
Output #2
1
Press button B once.
Input #3
-10 -20
Output #3
12
Press the buttons as follows: - Press button B once. - Press button A ten times. - Press button B once.
题目信息
题号
agc008_a
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。