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;
}
相关推荐
Skrrapper5 分钟前
【编程史】微软的起家之路:一代传奇的诞生
数据库·c++·microsoft
Super小白&33 分钟前
C++ 高可用线程池实现:核心 / 非核心线程动态扩缩容 + 任务超时监控
c++·线程池
小猪写代码37 分钟前
C语言系统函数-(新增)
c语言·开发语言
♛识尔如昼♛1 小时前
C 基础(3-2) - 数据和C
c语言·开发语言
多多想1 小时前
C++扫盲——为什么C/C++分文件要写h和cpp?
c语言·c++
adam_life1 小时前
【P8306 【模板】字典树】
数据结构·算法·字典树·trie·哈希表··结构体
liulilittle1 小时前
C++判断wchar_t空白字符
开发语言·c++
Wenhao.1 小时前
LeetCode Hot100 腐烂的橘子
算法·leetcode·职场和发展
行走的bug...1 小时前
支持向量机
算法·机器学习·支持向量机
晨非辰1 小时前
算法闯关日记 Episode :解锁链表「环形」迷局与「相交」奥秘
数据结构·c++·人工智能·后端·python·深度学习·神经网络