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;
}
相关推荐
Blossom.1184 分钟前
大模型自动化压缩:基于权重共享的超网神经架构搜索实战
运维·人工智能·python·算法·chatgpt·架构·自动化
优选资源分享14 分钟前
MD5 哈希值校验工具 v1.5.3 实用文件校验工具
算法·哈希算法
郝学胜-神的一滴16 分钟前
Qt实现圆角窗口的两种方案详解
开发语言·c++·qt·程序人生
CSDN_RTKLIB17 分钟前
【std::vector】size、capacity小结
c++·stl
AI科技星21 分钟前
能量绝对性与几何本源:统一场论能量方程的第一性原理推导、验证与范式革命
服务器·人工智能·科技·线性代数·算法·机器学习·生活
Coder_Boy_21 分钟前
基于SpringAI的在线考试系统-数据库表设计
java·数据库·算法
散峰而望25 分钟前
【算法竞赛】链表和 list
数据结构·c++·算法·链表·list·哈希算法·推荐算法
Legendary_00826 分钟前
从DC接口改成Type-C:LDR6328芯片助力传统设备升级快充体验
c语言·开发语言
至为芯29 分钟前
IP5385至为芯支持C口双向快充的30W到100W移动电源方案芯片
c语言·开发语言
爱编程的小吴30 分钟前
【力扣练习题】55. 跳跃游戏
算法·leetcode