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

 

题目传送门

 1 /*
 2     水题:读懂题目就能做
 3 */
 4 #include <cstdio>
 5 #include <iostream>
 6 #include <algorithm>
 7 #include <cstring>
 8 #include <cmath>
 9 #include <vector>
10 #include <string>
11 #include <queue>
12 #include <map>
13 #include <set>
14 using namespace std;
15 
16 const int MAXN = 1e2 + 10;
17 const int INF = 0x3f3f3f3f;
18 int a[MAXN][MAXN];
19 
20 int main(void)      //Codeforces Round #308 (Div. 2) A. Vanya and Table
21 {
22     // freopen ("A.in", "r", stdin);
23 
24     int n;
25     while (scanf ("%d", &n) == 1)
26     {
27         memset (a, 0, sizeof (a));
28         int x1, y1, x2, y2;
29         while (n--)
30         {
31             scanf ("%d%d%d%d", &x1, &y1, &x2, &y2);
32             for (int i=y1; i<=y2; ++i)
33             {
34                 for (int j=x1; j<=x2; ++j)
35                 {
36                     a[i][j]++;
37                 }
38             }
39         }
40         int ans = 0;
41         for (int i=1; i<=100; ++i)
42         {
43             for (int j=1; j<=100; ++j)    ans += a[i][j];
44         }
45 
46         printf ("%d\n", ans);
47     }
48 
49 
50     return 0;
51 }

 

posted @ 2015-06-19 11:44  Running_Time  阅读(131)  评论(0编辑  收藏  举报