A9909 | Vanya and Table
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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.
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.
输出格式
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$ .
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$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted