犁田:先xii列,再xii + 1列。。。。。。最后直至xur列;
每一列当中,写yii列,再yii + 1列。。。。。。最后直至yur列。
//P2956 [USACO09OCT]机器人犁田The Robot Plow
#include<iostream>
#include<cstring>
using namespace std;
int space[250][250];
int main()
{
ios::sync_with_stdio(false);
int x, y, i, x1, y1, x2, y2, count = 0;
cin >> x >> y >> i;
memset(space, 0, sizeof(space));
for(int a = 0; a < i; a++)
{
cin >> x1 >> y1 >> x2 >> y2;
for(int b = x1; b <= x2; b++)
for(int c = y1; c <= y2; c++)
space[b][c]++;
}
for(int m = 1; m <= x; m++)
for(int n = 1; n <= y; n++)
if(space[m][n] > 0) count++;
cout << count;
return 0;
}