#CF2009A. Minimize!

    ID: 6915 传统题 1000ms 256MiB 尝试: 1 已通过: 1 难度: 10 上传者: 标签>暴力数学CodeforcesCodeforces Round 971(Div4)Div4ACF2009A800

Minimize!

题目描述

给你两个整数 aabb (aba≤b) 。 在 cc (acba≤c≤b) 的所有可能整数值中,求 (ca)+(bc)(c−a)+(b−c) 的最小值。

输入格式

第一行包含 tt (1t551≤t≤55) -测试用例数。 每个测试用例包含两个整数 aabb (1ab101≤a≤b≤10) 。

输出格式

对于每个测试用例,另起一行输出 (ca)+(bc)(c−a)+(b−c) 的最小可能值。

样例

3
1 2
3 10
5 5
1
7
0

样例说明

In the first test case, you can choose c=1 c = 1 and obtain an answer of (11)+(21)=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=6 c = 6 and obtain an answer of (63)+(106)=7 (6 - 3) + (10 - 6) = 7 . It can be shown this is the minimum value possible.

来源

Codeforces 2009A,英文题名 Minimize!。