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. js上传文件研究

    https://github.com/shengulong/javascript-file-upload

  2. svn简单介绍

    版本号控制(Revision control)是维护project蓝图的标准做法,能追踪project蓝图从诞生一直到定案的过程.是一种记录若干文件内容变化.以便将来查阅特定版本号修订情况的系统. 能 ...

  3. selenium python (九)对话框处理

    #!/usr/bin/python# -*- coding: utf-8 -*-__author__ = 'zuoanvip' from selenium import  webdriver #对于对 ...

  4. react jsx 数组变量的写法

    1.通过 map 方法 var students = ["张三然","李慧思","赵思然","孙力气","王萌 ...

  5. Android——坐标系及转化

    一.坐标系 Android应用层坐标系原点在左上角,坐标范围(0,0)——(width,height). Android底层坐标系原点在屏幕中央,坐标范围(-1000,,1000)——(1000,10 ...

  6. Android的Message Pool是个什么鬼,Message Pool会否引起OOM——源代码角度分析

    引言 Android中,我们在线程之间通信传递通常採用Android的消息机制,而这机制传递的正是Message. 通常.我们使用Message.obtain()和Handler.obtainMess ...

  7. 转移iOS App常见问题和回答

    打算转移公司的app,做下转移的记录 怎样转移app官方的一个视频:http://v.youku.com/v_show/id_XNjI0MjQxMzI0.html 以下是apple官方转移常见问题回答 ...

  8. atitit.窗口静听esc退出本窗口java swing c# .net php

    atitit.窗口静听esc退出本窗口java swing c# .net php 1. 监听esc  按键 1 1.1. 监听一个组件 1 1.2. 监听加在form上 1 2. 关闭窗口 2 1. ...

  9. 简明扼要谈Spring IOC的好处

    http://a-kuei.iteye.com/blog/676524 iOC:控制反转,它是不是什么技术,它是一种设计模式.所谓控制反转就是由容器控制程序间的关系,而不是传统实现中,由编程代码直接操 ...

  10. Spark 学习笔记:(三)Spark SQL

    参考:https://spark.apache.org/docs/latest/sql-programming-guide.html#overview http://www.csdn.net/arti ...