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;
}
相关推荐
杜小暑几秒前
动态内存管理
c语言·开发语言·动态内存管理
YuforiaCode18 分钟前
第十二届蓝桥杯 2021 C/C++组 直线
c语言·c++·蓝桥杯
知来者逆36 分钟前
计算机视觉——速度与精度的完美结合的实时目标检测算法RF-DETR详解
图像处理·人工智能·深度学习·算法·目标检测·计算机视觉·rf-detr
阿让啊41 分钟前
C语言中操作字节的某一位
c语言·开发语言·数据结构·单片机·算法
এ᭄画画的北北42 分钟前
力扣-160.相交链表
算法·leetcode·链表
拾忆-eleven1 小时前
C语言实战:用Pygame打造高难度水果消消乐游戏
c语言·python·pygame
草莓啵啵~1 小时前
搜索二叉树-key的搜索模型
数据结构·c++
共享家95271 小时前
深入理解C++ 中的list容器
c++
孞㐑¥1 小时前
C++11介绍
开发语言·c++·经验分享·笔记
云小逸1 小时前
【QQMusic项目界面开发复习笔记】第二章
c++·qt