#include<stdio.h>
#include<string.h>
#define M 501
bool board[M][M];
int main()
{
int w,h,n,i,j,k,fs,x1,y1,x2,y2;
//freopen("in.txt","r",stdin);
while(scanf("%d%d%d",&w,&h,&n)&&(w+h+n))
{
memset(board,1,sizeof(board));
for(k=1;k<=n;k++)
{
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
if(x1>x2)
x1=x1^x2,x2=x1^x2,x1=x1^x2;
if(y1>y2)
y1=y1^y2,y2=y1^y2,y1=y1^y2;
for(i=x1;i<=x2;i++)
for(j=y1;j<=y2;j++)
board[i][j]=0;
}
fs=0;
for(i=1;i<=w;i++)
for(j=1;j<=h;j++)
fs+=board[i][j];
if(!fs)
printf("There is no empty spots.\n");
else if(fs==1)
printf("There is one empty spot.\n");
else
printf("There are %d empty spots.\n",fs);
}
return 0;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.