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;
}
相关推荐
深盾科技39 分钟前
C/C++逆向分析实战:变量的奥秘与安全防护
c语言·c++·安全
海洲探索-Hydrovo3 小时前
TTP Aether X 天通透传模块丨国产自主可控大数据双向通讯定位模组
网络·人工智能·科技·算法·信息与通信
ajassi20003 小时前
开源 C++ QT QML 开发(二十)多媒体--摄像头拍照
c++·qt·开源
_OP_CHEN3 小时前
C++基础:(十二)list类的基础使用
开发语言·数据结构·c++·stl·list类·list核心接口·list底层原理
2401_841495646 小时前
【计算机视觉】基于复杂环境下的车牌识别
人工智能·python·算法·计算机视觉·去噪·车牌识别·字符识别
Jonkin-Ma6 小时前
每日算法(1)之单链表
算法
奔跑吧邓邓子6 小时前
【C语言实战(8)】C语言循环结构(do-while):解锁编程新境界
c语言·实战·do-while
晚风残6 小时前
【C++ Primer】第六章:函数
开发语言·c++·算法·c++ primer
小莞尔6 小时前
【51单片机】【protues仿真】基于51单片机温度测量系统
c语言·单片机·嵌入式硬件·物联网·51单片机
杨云强6 小时前
离散积分,相同表达式数组和公式
算法