AcWing 3203. 画图
原题链接
简单
作者:
我要出去乱说
,
2021-02-19 21:53:54
,
所有人可见
,
阅读 320
#include <iostream>
using namespace std;
const int N = 110;
int n;
bool st[N][N]; //整一个布尔矩阵存涂了颜色的区块
int main()
{
cin >> n;
while (n -- )
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
for (int i = x1; i < x2; i ++ )
for (int j = y1; j < y2; j ++ )
st[i][j] = true; //涂了就true,重复涂也不会影响
}
int res = 0;
for (int i = 0; i < N; i ++ )
for (int j = 0; j < N; j ++ )
res += st[i][j]; //统计一下总共多少涂颜色的块
cout << res << endl;
return 0;
}