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;
}
相关推荐
cpp_25012 小时前
P1024 [NOIP 2001 提高组] 一元三次方程求解
数据结构·c++·算法·题解·二分答案·洛谷·csp
田梓燊8 小时前
力扣:23.合并 K 个升序链表
算法·leetcode·链表
re林檎9 小时前
算法札记——4.27
算法
数据牧羊人的成长笔记9 小时前
逻辑回归与Softmax回归
算法·回归·逻辑回归
郑州光合科技余经理10 小时前
同城O2O海外版二次开发实战:从支付网关到配送算法
开发语言·前端·后端·算法·架构·uni-app·php
张健115640964811 小时前
使用信号量限制并发数量
开发语言·c++
jc062011 小时前
6.1云原生之Docker
c++·docker·云原生
上弦月-编程11 小时前
递归实现C语言菱形图案打印
c语言
Mrlxl.cn12 小时前
计算机网络——网络层
c语言·数据结构·计算机网络·考研
d111111111d13 小时前
STM32-UART封装问题解析
笔记·stm32·单片机·嵌入式硬件·学习·算法