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;
}
相关推荐
十子木26 分钟前
C++ 类似pytorch的库,工具包,或者机器学习的生态
c++·pytorch·机器学习
多喝开水少熬夜26 分钟前
损失函数系列:focal-Dice-vgg
图像处理·python·算法·大模型·llm
学习路上_write1 小时前
STM32回调函数使用/定时器/GPIO/串口/
c语言·单片机·嵌入式硬件
立志成为大牛的小牛1 小时前
数据结构——三十七、关键路径(王道408)
数据结构·笔记·程序人生·考研·算法
ytttr8731 小时前
基于MATLAB的Relief算法特征权重选择实现
算法
czy87874752 小时前
C语言实现状态模式
c语言·状态模式
Freshman小白2 小时前
python算法打包为docker镜像(边缘端api服务)
python·算法·docker
czy87874752 小时前
C语言实现迭代器模式
c语言·迭代器模式
mit6.8242 小时前
[VT-Refine] Simulation | Fine-Tuning | docker/run.sh
算法
朴shu3 小时前
Delta数据结构:深入剖析高效数据同步的奥秘
javascript·算法·架构