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;
}
相关推荐
鹿角片ljp10 小时前
力扣7.整数反转-从基础到边界条件
算法·leetcode·职场和发展
java修仙传10 小时前
力扣hot100:前K个高频元素
算法·leetcode·职场和发展
小乔的编程内容分享站10 小时前
C语言指针相关笔记
c语言·笔记
嗷嗷哦润橘_10 小时前
从萝卜纸巾猫到桌游:“蒸蚌大开门”的设计平衡之旅
人工智能·算法·游戏·概率论·桌游
xiaoye-duck10 小时前
吃透C++类和对象(下):内部类、匿名对象及编译器优化的深度解析
c++
TracyCoder12310 小时前
Java String:从内存模型到不可变设计
java·算法·string
情缘晓梦.10 小时前
C++ 内存管理
开发语言·jvm·c++
我是大咖10 小时前
二维数组与数组指针
java·数据结构·算法
筵陌11 小时前
算法:动态规划
算法·动态规划
大江东去浪淘尽千古风流人物11 小时前
【DSP】xiBoxFilter_3x3_U8 dsp VS cmodel
linux·运维·人工智能·算法·vr