犁田机器人
6 4 2
1 1 2 4
1 3 5
4
样例输出 SampleOutput [复制数据]
14
题解:
#include <stdio.h> int main(void) { long x,y,p,x1,y1,x2,y2,i=0,j,t,sum=0,a[300][300]={0}; scanf("%Id%Id%Id\n",&y,&x,&p); for (i=1;i<=p;i++) { scanf("%Id%Id%Id%Id",&y1,&x1,&y2,&x2); for (j=x1;j<=x2;j++) for (t=y1;t<=y2;t++) a[j][t]=1; } for (i=1;i<=x;i++) for (j=1;j<=y;j++) { if (a[i][j]==1) sum++; } printf("%d\n",sum); return 0; }
[TYVJ] P1026 犁田机器人,布布扣,bubuko.com
原文:http://www.cnblogs.com/sxiszero/p/3591833.html