A. Minimize!

time limit per test

1 second

memory limit per test

256 megabytes

You are given two integers aa and bb (a≤ba≤b). Over all possible integer values of cc (a≤c≤ba≤c≤b), find the minimum value of (c−a)+(b−c)(c−a)+(b−c).

Input

The first line contains tt (1≤t≤551≤t≤55) --- the number of test cases.

Each test case contains two integers aa and bb (1≤a≤b≤101≤a≤b≤10).

Output

For each test case, output the minimum possible value of (c−a)+(b−c)(c−a)+(b−c) on a new line.

Example

Input

Copy

复制代码

3

1 2

3 10

5 5

Output

Copy

复制代码
1
7
0

Note

In the first test case, you can choose c=1c=1 and obtain an answer of (1−1)+(2−1)=1(1−1)+(2−1)=1. It can be shown this is the minimum value possible.

In the second test case, you can choose c=6c=6 and obtain an answer of (6−3)+(10−6)=7(6−3)+(10−6)=7. It can be shown this is the minimum value possible.

解题说明::水题,结果就是b-a

cpp 复制代码
#include <stdio.h>

int main() 
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		printf("%d\n", b - a);
	}
	return 0;
}
相关推荐
_codemonster4 分钟前
深度学习实战(基于pytroch)系列(四十八)AdaGrad优化算法
人工智能·深度学习·算法
老王熬夜敲代码9 分钟前
C++中的thread
c++·笔记·面试
鹿角片ljp23 分钟前
力扣140.快慢指针法求解链表倒数第K个节点
算法·leetcode·链表
qq_4798754338 分钟前
C++ 鸭子类型” (Duck Typing)
开发语言·c++
自由生长202440 分钟前
位运算第1篇-异或运算-快速找出重复数字
算法
崇山峻岭之间1 小时前
C++ Prime Plus 学习笔记033
c++·笔记·学习
xxxxxmy1 小时前
同向双指针(滑动窗口)
python·算法·滑动窗口·同向双指针
暗然而日章1 小时前
C++基础:Stanford CS106L学习笔记 7 类
c++·笔记·学习
释怀°Believe1 小时前
Daily算法刷题【面试经典150题-5️⃣图】
算法·面试·深度优先
List<String> error_P1 小时前
数据结构:链表-单向链表篇
算法·链表