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;
}
相关推荐
fpcc3 分钟前
跟我学C++中级篇—std::conjunction手动实现
c++
项目題供诗6 分钟前
C语言基础(三)
c语言·c++
码农水水16 分钟前
中国电网Java面试被问:流批一体架构的实现和状态管理
java·c语言·开发语言·面试·职场和发展·架构·kafka
1***438024 分钟前
C++跨平台开发的核心挑战线程管理等基础功能
开发语言·c++
a31582380628 分钟前
大语言模型应用开发技术要求
算法·大语言模型·应用开发
倦王30 分钟前
力扣日刷26112
算法·leetcode·职场和发展
liu****40 分钟前
能源之星案例
人工智能·python·算法·机器学习·能源
2501_901147831 小时前
环形房屋打家劫舍算法
考研·算法·leetcode·高考
智驱力人工智能1 小时前
守护矿山动脉 矿山皮带跑偏AI识别系统的工程化实践与价值 皮带偏离检测 皮带状态异常检测 多模态皮带偏离监测系统
大数据·人工智能·opencv·算法·安全·yolo·边缘计算
txinyu的博客1 小时前
C++ 智能指针 (shared_ptr/weak_ptr) 全解析
开发语言·c++