C. Celex Update
C.CELEX最新情况
time limit per test: 2 seconds
每次测试的时间限制:2秒
memory limit per test: 256 megabytes
每次测试的内存限制:256兆字节
input: standard input
输入:标准输入
output: standard output
产出:标准产出
During the quarantine, Sicromoft has more free time to create the new functions in “celex-2021”. The developers made a new function
在检疫期间,Smicromoft有更多的空闲时间来创建“CELEX-2021”中的新功能。开发人员做了一个新的功能。
GAZ-GI z, which infinitely flls an infinite table to the right and down from the upper left corner as follows:
Gaz-GI z,它从左上角无限地将一张无限的桌子从左上角摇到右下角,如下所示:
The cell with coordinates (x, y) is at the intersection of ax-th row and y-th column. Upper left cell (1, 1) contains an integer 1.
坐标为(x,y)的单元格位于第AX行和y列的交点处.左上角单元格(1,1)包含整数1。
The developers of the SUM function don’t sleep either. Because of the boredom, they teamed up with the developers of the RAND function,
SUM函数的开发人员也不睡觉。因为无聊,他们和RAND函数的开发人员合作,
so they added the ability to calculate the sum on an arbitrary path from one cell to another, moving down or right. Formally, from the cell
因此,他们增加了计算从一个单元格到另一个单元格的任意路径上的和,向下或向右移动的能力。形式上,从牢房里
(x, y) in one step you can move to thecell (x + 1,y)or (x,y+ 1).
(x,y)在一个步骤中,您可以移动到单元格(x+1,y)或(x,y+1)。
After another Dinwows update, Levian started to study “celex-2021” (because he wants to be an accountant!). After fling in the table
又一次丁沃更新后,利维安开始学习“CELEX-2021”(因为他想成为一名会计师!)在被扔进桌子后
with the GAZ-GIZ function, he asked you to calculate the quantity of possible diferent amounts on the path from a given cell (x1, y1) to
使用gaz-giz函数,他要求您计算从给定单元格(x1,y1)到给定单元格(x1,y1)的路径上可能存在的不同数量。
another given cell (x2, 9Y2), if you can only move one cell down or right.
另一个给定的单元格(x2,9Y2),如果只能向下或向右移动一个单元格。
Formally, consider all the paths from the cell (x1, y1) to cell (x2, y2) such that each next cell in the path is located either to the down or to
形式上,考虑从单元格(x1,y1)到单元格(x2,y2)的所有路径,以便路径中的每个下一个单元格位于向下或
the right of the previous one. Calculate the number of dfferent sums of elements for all such paths.
前一个的权利。计算所有这些路径的元素的不同和数。
Input
输入
The first line contains one integert(1≤t < 57179)- the number of test cases.
第一行包含一个整数(1≤t<57179)-测试用例数。
Each of the fllowing t lines contains four natural numbers x1. Y1, x2. Y2(1 < x1< x2 < 10’,1 < y1 < Y2 < 10%)- coordinates of
每条弯曲的t线都包含四个自然数x1。Y1,X2Y2(1<x1<x2<10‘,1<y1<y2<10%)-坐标
the start and the end cells.
开始和结束细胞。
Output
输出量
For each test case, in a separate line, print the number of possible diferent sums on the way from the start cell to the end cell.
对于每个测试用例,在一个单独的行中,在从起始单元格到结束单元格的路上打印可能的不同和数。
每次提前转向都会使总数加一,故算出最大值与最小值只差即可
int main()
{
int t;
long long a,b,c,d;
cin>>t;
while(t--)
{
cin>>a>>b>>c>>d;
cout<<abs((c-a)*(d-b))+1<<endl;
}
return 0;
}