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 ;
}

最新文章

  1. 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置
  2. 第K 小数
  3. 个人推荐,比较好的MySQL客户端工具
  4. laravel5.3 笔记一
  5. 检查ORACLE的警告文件的脚本
  6. javascrip格式
  7. css3实现三角形,聊天背景气泡,心形等形状
  8. iOS中Block介绍(一)基础
  9. yowsup ( an application to use whatsapp) hack
  10. 201521123052《Java程序设计》第3周学习总结
  11. 深入浅出 Spring
  12. 测试输出System.err与System.out
  13. soamanager发布的Webservice服务,调用时出现http500报错
  14. Python OpenCV人脸识别案例
  15. 【WC2018】州区划分(FWT,动态规划)
  16. java 线程(四)线程安全 同步方法
  17. Jquery 插件 图片验证码
  18. .Net ASP.NET 打开指定文件夹
  19. scala-02-基本数据类型-string-分支循环
  20. C#重新启动时,关闭较早的进程

热门文章

  1. Effective C++ Item 47 请使用 traits classes 表现类型信息
  2. 内存管理[5]通过 GetProcessHeaps 函数获取了当前进程的堆句柄列表
  3. PHP中extract()函数的妙用
  4. MongoDB:分片(简介 &amp; 自动分片 &amp; 片键)
  5. 【转载】C#中回滚TransactionScope的使用方法和原理
  6. uva 10806 Dijkstra, Dijkstra. (最小费最大流)
  7. ArcGIS 10.3 for Server新特性介绍
  8. Android版DesiredCapabilities参数配置
  9. RabbitMQ/pika模块
  10. Python 006- python socket编程详细介绍