【题意】
对于一个100*100棋盘,进行下列三种操作
BLACK x y l 将(x,y)为左上角,边长为l的正方形涂黑
WHITE x y l 将(x,y)为左上角,边长为l的正方形涂白
TEST x y l 问(x,y)为左上角,边长为l的正方形有多少个黑色格子
【输入】
第一行一个数字t,表示操作次数
接下来每行一个命令
【输出】
每行回答一次TEST询问
暴力水过
program poj1656;
var
ans,t,i,j,k,x,y,l:longint;
color:array [0..101,0..101] of boolean;
order:string;
temp:char;
begin
fillchar(color,sizeof(color),false);
readln(t);
for k:=1 to t do
begin
order:='';
repeat
read(temp);
order:=order+temp;
until temp=' ';
delete(order,length(order),1);
readln(x,y,l);
ans:=0;
for i:=x to x+l-1 do
for j:=y to y+l-1 do
if order='WHITE' then
color[i,j]:=false
else
if order='BLACK' then
color[i,j]:=true
else
if color[i,j] then
inc(ans);
if order='TEST' then writeln(ans);
end;
end.