time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

 

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.

Input

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

Each of the following n lines contains four integers x1, y1, x2, y2 (1 ≤ x1 ≤ x2 ≤ 100, 1 ≤ y1 ≤ y2 ≤ 100), where x1 and y1 are the number of the column and row of the lower left cell and x2 and y2 are the number of the column and row of the upper right cell of a rectangle.

Output

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

Examples
input
2
1 1 2 3
2 2 3 3
output
10
input
2
1 1 3 3
1 1 3 3
output
18
Note

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.

题意:

给定n组的两点坐标,求以两点做对角顶点的矩形占多少格子即面积和。

附AC代码:

 #include<bits/stdc++.h>
using namespace std; int main() {
int n;
cin >> n;
int sum = ;
while (n--) {
int x1, x2, y1,y2;
cin >> x1 >> y1>>x2>>y2;
int x = x2-x1+;
int y = y2-y1+;
sum += x*y;
}
cout << sum << endl;
return ;
}

A. Vanya and Table的更多相关文章

  1. Codeforces Round #308 (Div. 2) A. Vanya and Table 暴力

    A. Vanya and Table Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/552/pr ...

  2. 水题 Codeforces Round #308 (Div. 2) A. Vanya and Table

    题目传送门 /* 水题:读懂题目就能做 */ #include <cstdio> #include <iostream> #include <algorithm> ...

  3. 【84.62%】【codeforces 552A】Vanya and Table

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  4. #308 (div.2) A. Vanya and Table

    1.题目描写叙述:点击打开链接 2.解题思路:本题是一道简单的模拟题.每次扫描一个输入的长方形,然后将内部全部点都+1,终于统计数组全部元素的和就可以. 3.代码: #define _CRT_SECU ...

  5. Codeforces Round #308 (Div. 2) A B C 水 数学

    A. Vanya and Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. Codeforces Round #308 (Div. 2)

    A. Vanya and Table   Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows ...

  7. codeforces 677D D. Vanya and Treasure(二维线段树)

    题目链接: D. Vanya and Treasure time limit per test 1.5 seconds memory limit per test 256 megabytes inpu ...

  8. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) C. Table Tennis Game 2 水题

    C. Table Tennis Game 2 题目连接: http://codeforces.com/contest/765/problem/C Description Misha and Vanya ...

  9. Codeforces Round #355 (Div. 2) D. Vanya and Treasure 分治暴力

    D. Vanya and Treasure 题目连接: http://www.codeforces.com/contest/677/problem/D Description Vanya is in ...

随机推荐

  1. 【gradle】mac上安装gradle

    根据gradle官网指导,一步一步安装即可 https://gradle.org/install/ 或者,如果你没有办法墙出去,或者本地使用命令下载gradle比较慢的话,可以采用下面的方式 ==== ...

  2. Action Bar详解(二)

    在Android3.0之后,Google对UI导航设计上进行了一系列的改革,其中有一个非常好用的新功能就是引入的ActionBar,他用于取代3.0之前的标题栏,并提供更为丰富的导航效果. 一.添加A ...

  3. openURL

    在iOS开发中,经常需要调用其它App,如拨打电话.发送邮件等.UIApplication:openURL:方法是实现这一目的的 在iOS开发中,经常需要调用其它App,如拨打电话.发送邮件等.UIA ...

  4. 【c++】面向对象程序设计之虚函数详解

    一.动态绑定什么时候发生 当且仅当通过指针或引用调用虚函数时,才会在运行时解析该调用 二.派生类中的虚函数 当我们在派生类中覆盖了某个虚函数时,可以再一次使用virtual指出该函数的性质,但是这么做 ...

  5. [Tools] Convert SVG to a PDF in Node with PDFKit and SVG.js

    Given a epxress application and an svg template, we want to draw some text, date onto it and convert ...

  6. JS创建对象几种不同方法具体解释

    1.工厂模式 弊端:没有解决对象的识别问题,即怎么知道一个对象的类型. 2.构造函数模式 与工厂模式相比: 1.没有显式的创建对象 2.直接将属性和方法赋给了this对象 3.没有return语句 要 ...

  7. WPF DataGrid获取选择行的数据

    在WPF中,单击DataGrid,如何获取当前点击的行? 比如在MouseDoubleClick事件中,事实上获取的选中行是一个DataRowview,你可以通过以下的方法来获取选中行的数据,需要引用 ...

  8. Hadoop集群搭建-虚拟机安装(转)(一)

    1.软件准备 a).操作系统:CentOS-7-x86_64-DVD-1503-01 b).虚拟机:VMware-workstation-full-9.0.2-1031769(英文原版先安装)  VM ...

  9. 在C/C++中使用VLD检测内存泄漏

    VLD地址:https://kinddragon.github.io/vld/ 若出现内存泄漏,VS输出窗口会有如下提示: 若要确定造成内存泄漏的代码位置,仅需进入工程属性->链接器->调 ...

  10. RFC外部断点在在SAP退出后会失效

    rfc外部断点系统退出后会删除吗?  不会删除Rfc外部断点在在SAP退出后标识还在, 但是断点会失效! 附 断点消息: ABAP 中的断点分为静态和动态两种.一. 静态断点(Static Break ...