AcWing 3203. 画图
原题链接
简单
作者:
王小强
,
2021-02-17 10:52:46
,
所有人可见
,
阅读 340
模拟
// Brute Force
// Time Complexity: O(n * M * N)
#include <iostream>
#include <cstring>
using namespace std;
const int N = 105;
int g[N][N], n, x1, y1, x2, y2;
int main(void) {
scanf("%d", &n);
while (n--) {
scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
for (int y = N - 1 - y2; y < N - 1 - y1; ++y)
for (int x = x1; x < x2; ++x) g[y][x] = 1;
}
int ans = 0;
for (int y = 0; y < N; ++y)
for (int x = 0; x < N; ++x)
ans += g[y][x];
printf("%d\n", ans);
return 0;
}