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;
}
相关推荐
景彡先生2 小时前
C++并行计算:OpenMP与MPI全解析
开发语言·c++
归去_来兮3 小时前
深度学习模型在C++平台的部署
c++·深度学习·模型部署
黑听人4 小时前
【力扣 困难 C】329. 矩阵中的最长递增路径
c语言·leetcode
pay4fun4 小时前
2048-控制台版本
c++·学习
YuTaoShao5 小时前
【LeetCode 热题 100】141. 环形链表——快慢指针
java·算法·leetcode·链表
JeffersonZU6 小时前
Linux/Unix 套接字Socket编程(socket基本概念,流程,流式/数据报socket,Unix domain socket示例)
linux·c语言·tcp/ip·udp·unix·gnu
hjjdebug6 小时前
ffplay6 播放器关键技术点分析 1/2
c++·ffmpeg·音视频
小小小新人121236 小时前
C语言 ATM (4)
c语言·开发语言·算法
Azxcc07 小时前
C++异步编程入门
开发语言·c++
吐泡泡_7 小时前
C++(STL源码刨析/vector)
c++