今天在做题的时候遇到了一些我不太能解决的困难,请大家们帮我解决一下
#include <stdio.h>
using namespace std;
struct NODE {
int X1,X2,Y1,Y2;//X coordinate and y coordinate
int width,lengh;//The length and width of a rectangle
};
int cnt=0;
struct NODE a[1024];
int n;//numbers of the coordinates
int main(int args,char **argc) {
scanf("%d",&n);//input n
for(int i=0;i<n;i++) {
scanf("%d %d %d %d",&a[i].X1,&a[i].Y1,&a[i].X2,&a[i].Y2);//input the coordinates
a[i].width=a[i].Y2-a[i].Y1;// Rectangular width
a[i].lengh=a[i].X2-a[i].X1;//Rectangular length
cnt+=a[i].lengh*a[i].width;
}
printf("%d",cnt);
return 0;
}
#if 0
input
2
2 2 9 5
6 1 12 9
output
60
#endif