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;
}
相关推荐
Z1Jxxx2 分钟前
字符串翻转
开发语言·c++·算法
闻缺陷则喜何志丹3 分钟前
【前缀和 期望】P7875 「SWTR-7」IOI 2077|普及+
c++·算法·前缀和·洛谷·期望
CSDN_RTKLIB14 分钟前
ODR、linkage问题解惑
开发语言·c++
CoovallyAIHub17 分钟前
超越Sora的开源思路:如何用预训练组件高效训练你的视频扩散模型?(附训练代码)
深度学习·算法·计算机视觉
宵时待雨20 分钟前
数据结构(初阶)笔记归纳1:复杂度讲解
c语言·数据结构·笔记
源来猿往26 分钟前
yolov8n结构化剪枝
算法·yolo·剪枝
非得登录才能看吗?29 分钟前
C++多线程简单版(C++11 及以上)
c++
tongxianchao29 分钟前
MetaPruning: Meta Learning for Automatic Neural Network Channel Pruning
算法·机器学习·剪枝
今儿敲了吗30 分钟前
第二章 C++对C的核心拓展
c++·笔记
2301_8002561131 分钟前
【数据库pgsql】车辆轨迹分析视图的创建和查询代码解析
人工智能·算法·机器学习