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;
}
相关推荐
徐凤年_28 分钟前
rog_map参数理解
算法
春日见29 分钟前
算法与数据结构----哈希表
数据结构·人工智能·算法·机器学习·自动驾驶·哈希算法·散列表
萌动的小火苗1 小时前
嵌入式开发中的栈与队列:任务调度为什么依赖数据结构
数据结构·c++·单片机·嵌入式硬件
叩码以求索1 小时前
统计按位或能得到最大值的子集数目(一)
数据结构·算法
tachibana21 小时前
hot100 数组中的第K个最大元素(215)
java·数据结构·算法·leetcode
txzrxz2 小时前
单调队列讲解
数据结构·c++·算法·单调队列
WWTYYDS_6662 小时前
JsonCpp超详细使用教程
c++
blevoice2 小时前
抖抖燃脂机单 AC6966B 主控调试踩坑:Type-C 整机供电喇叭无声排障
c语言·开发语言·单片机
不会就选b2 小时前
算法日常・每日刷题--<快排>4
算法
Keven_112 小时前
算法札记:树状数组的用途
数据结构·算法