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

简介:

题目链接:http://codeforces.com/contest/552/problem/A
hint: 就是求几个矩形的面积

#include <iostream>
#include <cmath>
using namespace std;
struct point
{
    int x;
    int y;
}a[2];
int main()
{
    int m;
    while(cin>>m)
    {
        int sum=0;
        while(m--)
        {
        //注释的是方法一
            cin>>a[0].x>>a[0].y>>a[1].x>>a[1].y;
//            for(int i=a[0].x; i<=a[1].x; i++)
//                for(int j=a[0].y; j<=a[1].y; j++)
//                  sum++;
            sum+=abs(a[1].x-a[0].x+1)*abs(a[1].y-a[0].y+1);
        }
        cout<<sum<<endl;
    }
    return 0;
}
目录
相关文章
|
27天前
|
人工智能 测试技术 C++
Codeforces Round 962 (Div. 3)
Codeforces Round 962 (Div. 3)
|
人工智能 算法 BI
Codeforces Round 891 (Div. 3)
Codeforces Round 891 (Div. 3)
118 0
Codeforces Round 891 (Div. 3)
Codeforces Round #192 (Div. 2) (330A) A. Cakeminator
如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕。
46 0
Codeforces Round #742 (Div. 2)
Codeforces Round #742 (Div. 2)
45 0
|
机器学习/深度学习 人工智能
Codeforces Round 889 (Div. 2)
Codeforces Round 889 (Div. 2)
154 0
|
人工智能
Codeforces Round #786 (Div. 3)(A-D)
Codeforces Round #786 (Div. 3)(A-D)
70 0
Codeforces Round #675 (Div. 2) A~D
Codeforces Round #675 (Div. 2) A~D
152 0
Codeforces Round #644 (Div. 3)(A~G)
Codeforces Round #644 (Div. 3)(A~G)
121 0
Codeforces Round #723 (Div. 2)B. I Hate 1111
Description You are given an integer x. Can you make x by summing up some number of 11,111,1111,11111,…? (You can use any number among them any number of times). For instance, 33=11+11+11 144=111+11+11+11
176 0
Codeforces Round #723 (Div. 2)B. I Hate 1111