poj 1656 Counting Black

#include<iostream>
#include
<string>
using namespace std;
int table[101][101];
int main()
{
string str;
int n,x,y,l;
cin
>>n;
while(n--)
{
cin
>>str>>x>>y>>l;
if(str=="BLACK")
for(int i=x;i<x+l;++i)
for(int j=y;j<y+l;++j)
table[i][j]
=1;
else if(str=="WHITE")
for(int i=x;i<x+l;++i)
for(int j=y;j<y+l;++j)
table[i][j]
=0;
else
{
int s=0;
for(int i=x;i<x+l;++i)
for(int j=y;j<y+l;++j)
s
+=table[i][j];
cout
<<s<<endl;
}
}
return 0;
}

  

posted on 2011-07-22 20:24  sysu_mjc  阅读(103)  评论(0编辑  收藏  举报

导航