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;
}
相关推荐
条tiao条4 分钟前
KMP 算法详解:告别暴力匹配,让字符串匹配 “永不回头”
开发语言·算法
干啥啥不行,秃头第一名10 分钟前
C++20概念(Concepts)入门指南
开发语言·c++·算法
zzh9407723 分钟前
Gemini 3.1 Pro 硬核推理优化剖析:思维织锦、动态计算与国内实测
算法
2301_8073671937 分钟前
C++中的解释器模式变体
开发语言·c++·算法
愣头不青1 小时前
617.合并二叉树
java·算法
always_TT1 小时前
C语言中的字符与字符串(char数组)
c语言·开发语言
MIUMIUKK1 小时前
双指针三大例题
算法
forAllforMe1 小时前
LAN9252 从机寄存器配置--C语言举例
c语言·开发语言
灵感__idea1 小时前
Hello 算法:复杂问题的应对策略
前端·javascript·算法
17(无规则自律)2 小时前
【Linux驱动实战】:字符设备之ioctl与mutex全解析
linux·c语言·驱动开发·嵌入式硬件