CF552A.Vanya and Table

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right.

In this table, Vanya chose n rectangles with sides that go along borders of squares (some rectangles probably occur multiple times). After that for each cell of the table he counted the number of rectangles it belongs to and wrote this number into it. Now he wants to find the sum of values in all cells of the table and as the table is too large, he asks you to help him find the result.

瓦尼亚有一张由 100 行组成的表格,每行包含 100 个单元格。行号从下到上依次为整数 11 到 100100,列号从左到右依次为整数 11 到 100100。

在此表格中,瓦尼亚选择了 nn 个边与方格边界重合的矩形(某些矩形可能出现多次)。随后,他对表格中的每个单元格统计了其所属的矩形个数,并将该数目填入该单元格中。现在,他希望求出表格中所有单元格内数值的总和;但由于表格过大,他请你帮忙计算该结果。

输入格式

The first line contains integer n (1 ≤ n ≤ 100) — the number of rectangles.

Each of the following n lines contains four integers _x_1, _y_1, _x_2, _y_2 (1 ≤ _x_1 ≤ _x_2 ≤ 100, 1 ≤ _y_1 ≤ _y_2 ≤ 100), where _x_1 and _y_1 are the number of the column and row of the lower left cell and _x_2 and _y_2 are the number of the column and row of the upper right cell of a rectangle.

第一行包含一个整数 nn(1≤n≤1001 \leq n \leq 100)—— 矩形的数量。

接下来的 nn 行中,每行包含四个整数 x1, y1, x2, y2x_1,\ y_1,\ x_2,\ y_2(1≤x1≤x2≤1001 \leq x_1 \leq x_2 \leq 100,1≤y1≤y2≤1001 \leq y_1 \leq y_2 \leq 100),其中 x1x_1 和 y1y_1 分别表示矩形左下角单元格所在的列号和行号,x2x_2 和 y2y_2 分别表示矩形右上角单元格所在的列号和行号。

输出格式

In a single line print the sum of all values in the cells of the table.

在一行中输出表格中所有单元格的值的总和。

输入输出样例

  • 输入#1

    2
    1 1 2 3
    2 2 3 3

    输出#1

    10
  • 输入#2

    2
    1 1 3 3
    1 1 3 3

    输出#2

    18

说明/提示

Note to the first sample test:

Values of the table in the first three rows and columns will be as follows:

121

121

110

So, the sum of values will be equal to 10.

Note to the second sample test:

Values of the table in the first three rows and columns will be as follows:

222

222

222

So, the sum of values will be equal to 18.

第一个样例测试说明:

前三行前三列的表格数值如下:

121

121

110

因此,所有数值之和为 10。

第二个样例测试说明:

前三行前三列的表格数值如下:

222

222

222

因此,所有数值之和为 18。

输入解题思路,AI测评打分。不知道怎么写?

首页