AtCoder Regular Contest 123
翻译中…
Problem Statement
翻译中…
Given is a sequence of three integers $A = (A_1, A_2, A_3)$. On this sequence, you can do the following operation any number of times:
翻译中…
- choose
$i\in \{1,2,3\}$and add$1$to$A_i$.
翻译中…
Find the minimum number of operations needed to make $A$ arithmetic. Here, the sequence $A = (A_1, A_2, A_3)$ is arithmetic when $A_2 - A_1 = A_3 - A_2$ holds.
翻译中…
Constraints
翻译中…
$1\leq A_1, A_2, A_3\leq 10^{15}$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
A_1 A_2 A_3
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4 8 10
Output #1
2
One operation with $i = 1$ and then one operation with $i = 3$ yield an arithmetic sequence $(5, 8, 11)$.
Input #2
10 3 4
Output #2
4
Four operations with $i = 2$ yield an arithmetic sequence $(10, 7, 4)$.
Input #3
1 2 3
Output #3
0
The sequence $A$ is already arithmetic from the beginning, so we need zero operations.
Input #4
1000000000000000 1 1000000000000000
Output #4
999999999999999
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。