C. Celex Update

博客介绍了在Celex-2021软件中,开发人员新增了GAZ-GIz功能,该功能创建一个无限的表格,并允许计算从一个单元格到另一个单元格的任意路径上的元素和。用户可以仅向下或向右移动。给定起始和结束单元格的坐标,程序会计算所有可能路径的和的数量。提供的C++代码示例展示了如何计算这种和的差异数量。
摘要由CSDN通过智能技术生成

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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值