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;
}
相关推荐
mit6.8244 小时前
Xai架构
算法
WBluuue5 小时前
Codeforces 1078 Div2(ABCDEF1)
c++·算法
学无止境_永不停歇5 小时前
十、C++多态
开发语言·c++
寻星探路5 小时前
【JVM 终极通关指南】万字长文从底层到实战全维度深度拆解 Java 虚拟机
java·开发语言·jvm·人工智能·python·算法·ai
老歌老听老掉牙5 小时前
QT开发踩坑记:按钮点击一次却触发两次?深入解析信号槽自动连接机制
c++·qt
田里的水稻5 小时前
FA_融合和滤波(FF)-联邦滤波(FKF)
人工智能·算法·数学建模·机器人·自动驾驶
橘色的喵5 小时前
现代 C++17 相比 C 的不可替代优势
c语言·c++·现代c++·c++17
紫陌涵光6 小时前
112. 路径总和
java·前端·算法
浅念-6 小时前
C/C++内存管理
c语言·开发语言·c++·经验分享·笔记·学习
回敲代码的猴子6 小时前
2月8日上机
开发语言·c++·算法