Codeforces Round 1116 (Div. 2)
A
黑板上的三个数
Three Numbers on the Blackboard
Codeforces
800
原题
←B →

黑板上的三个数AI (CI翻译)

Rain is falling outside the Fairy Warehouse, so Chtholly, Nephren, and Ithea spend the afternoon playing a game in the common room.

雨下个不停,Fairy Warehouse 外一片雨幕,因此 Chtholly、Nephren 和 Ithea 整个下午都在休息室里玩游戏。AI (CI翻译)

Ithea writes three non-negative integers $a$, $b$, and $c$ on the blackboard.

Ithea 在黑板上写下三个非负整数 $a$、$b$ 和 $c$。AI (CI翻译)

Chtholly may perform the following operation an arbitrary number of times (possibly zero):

Chtholly 可以进行任意次(可能为零次)以下操作:AI (CI翻译)

  • Choose one of the three current integers and replace it with the sum of the other two current integers. The other two integers remain unchanged.
  • 选择当前三个整数中的一个,将其替换为另外两个当前整数之和。其余两个整数保持不变。
AI (CI翻译)

For example, starting from $(3,5,11)$, she can replace $11$ with $3+5$, obtaining $(3,5,8)$.

例如,初始为 $(3,5,11)$ 时,她可以将 $11$ 替换为 $3+5$,得到 $(3,5,8)$。AI (CI翻译)

Nephren wants to know the minimum range$^{\text{∗}}$ of the three integers that Chtholly can obtain. Help her find it!

Nephren 想知道 Chtholly 能得到的三个整数的最小极差$^{\text{∗}}$。请帮助她求出这个值!AI (CI翻译)

$^{\text{∗}}$The range of a non-empty finite collection of numbers is defined as its maximum value minus its minimum value. In particular, the range of three numbers $x$, $y$, and $z$ is $\max(x,y,z)-\min(x,y,z)$.

$^{\text{∗}}$非空有限数集的极差定义为其最大值减去最小值。特别地,三个数 $x$、$y$ 和 $z$ 的极差为 $\max(x,y,z)-\min(x,y,z)$。AI (CI翻译)

Input

输入格式

AI (CI翻译)

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). The description of the test cases follows.

每个测试包含多个测试用例。第一行包含测试用例的数量 $t$($1 \le t \le 100$)。接下来是各测试用例的描述。AI (CI翻译)

The only line of each test case contains three integers $a$, $b$, and $c$ ($0 \le a,b,c \le 10^9$) — the integers initially written on the blackboard.

每个测试用例仅一行,包含三个整数 $a$、$b$ 和 $c$($0 \le a,b,c \le 10^9$),表示初始写在黑板上的整数。AI (CI翻译)

Output

输出格式

AI (CI翻译)

For each test case, output a single integer — the minimum possible range of the three integers.

对于每个测试用例,输出一个整数,即三个整数可能达到的最小极差。AI (CI翻译)

Note

说明

AI (CI翻译)

In the first test case, all three integers are already equal, so their range is $0$.

在第一个测试用例中,三个整数已经相等,因此它们的极差为 $0$。AI (CI翻译)

In the second test case, performing no operation gives the range $9-4=5$. It can be shown that no sequence of operations can produce a smaller range.

在第二个测试用例中,不进行任何操作即可得到极差 $9-4=5$。可以证明,不存在任何操作序列能得到更小的极差。AI (CI翻译)

In the third test case, Chtholly can replace $10$ with $2+3=5$. The three integers become $(2,3,5)$, whose range is $5-2=3$.

在第三个测试用例中,Chtholly 可以将 $10$ 替换为 $2+3=5$。此时三个整数变为 $(2,3,5)$,极差为 $5-2=3$。AI (CI翻译)

In the fourth test case, Chtholly can replace $7$ with $0+0=0$. All three integers then become $0$.

在第四个测试用例中,Chtholly 可以将 $7$ 替换为 $0+0=0$。此后三个整数都变为 $0$。AI (CI翻译)

样例

Input #1
6
5 5 5
4 6 9
2 3 10
0 0 7
2 3 5
20 4 5
Output #1
0
5
3
0
3
5
InputCopy OutputCopy
题目信息
题号
2256A
时间限制
1 s
内存限制
256 MB
标签
数学
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。