306960: CF1278B. A and B
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
A and B
题意翻译
### 题意 有二整数 $a$ 和 $b$。你可以执行无数次操作,使得 $a$ 与 $b$ 相等。 操作如下:对于第 $k$ 次操作,你可以让 $a$ 或 $b$ 增加 $k$。 求使得 $a$ 和 $b$ 相等的最少操作数。 ### 输入格式 **本题输入中包含多组数据**。 第一行一个整数 $T$,表示数据组数。 对于每组数据:一行两个整数 $a$ 和 $b$。 ### 输出格式 对于每一组数据,输出一行一个数表示操作的最小次数。 ### 数据范围 $1 \leq T \leq 100$ $1 \leq a,b \leq 10^9$题目描述
You are given two integers $ a $ and $ b $ . You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by $ 1 $ ; during the second operation you choose one of these numbers and increase it by $ 2 $ , and so on. You choose the number of these operations yourself. For example, if $ a = 1 $ and $ b = 3 $ , you can perform the following sequence of three operations: 1. add $ 1 $ to $ a $ , then $ a = 2 $ and $ b = 3 $ ; 2. add $ 2 $ to $ b $ , then $ a = 2 $ and $ b = 5 $ ; 3. add $ 3 $ to $ a $ , then $ a = 5 $ and $ b = 5 $ . Calculate the minimum number of operations required to make $ a $ and $ b $ equal.输入输出格式
输入格式
The first line contains one integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The only line of each test case contains two integers $ a $ and $ b $ ( $ 1 \le a, b \le 10^9 $ ).
输出格式
For each test case print one integer — the minimum numbers of operations required to make $ a $ and $ b $ equal.
输入输出样例
输入样例 #1
3
1 3
11 11
30 20
输出样例 #1
3
0
4