You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.4 KiB

#include <bits/stdc++.h>
using namespace std;
//矩形结构体
struct rec {
int x1, y1, x2, y2;
};
int main() {
int n;
cin >> n;
//利用set去重
set<pair<int, int>> _set;
for (int i = 0; i < n; i++) {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int count = 0;
for (int j = x1; j < x2; j++) {
for (int k = y1; k < y2; k++) {
rec s;
s.x1 = j;
s.x2 = j + 1;
s.y1 = k;
s.y2 = k + 1;
_set.insert(make_pair(s.x1,s.y1));
count++;
}
}
// cout << "count=" << count << endl;
}
cout << _set.size() << endl;
return 0;
}
/*
struct rec {
int x1;
int x2;
int y1;
int y2;
} a[100];
int main() {
int n, i, j, k, f[100][100] = {0};
int s = 0;
cin >> n;
for (i = 0; i < n; i++) {
int count=0;
cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
for (j = a[i].x1; j < a[i].x2; j++)
for (k = a[i].y1; k < a[i].y2; k++) {
f[j][k] = 1;
count++;
}
cout<<"count="<<count<<endl;
}
for (i = 0; i < 100; i++)
for (j = 0; j < 100; j++) {
if (f[i][j] == 1) s++;
}
cout << s << endl;
return 0;
}
*/