poj1656
来源:互联网 发布:消防联动编程 编辑:程序博客网 时间:2024/06/05 14:17
【题意】
对于一个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.
- POJ1656
- poj1656
- POJ1656
- poj1656
- poj1656
- POJ1656
- poj1656
- poj1656----二维线段树
- poj1656 Counting Black
- poj1656 二维树状数组
- POJ1656 Counting Black [简单暴力]
- 北大ACM poj1656 Counting Black
- poj1656作为新手我都觉得水!!
- 白色网格统计poj1656-Counting Black
- 第18周报告2
- Java数据类型中String、Integer、int相互间的转换
- 我所理解的外链质量
- SAP SD Rebate 的财务凭证的说明
- MPLS L2VPN VLL原理
- poj1656
- 测试工程师职业要求汇总
- OpenGL
- 看其他人是怎么安排读书时间的
- 03_Activity 生命周期介绍【图解】
- 将String保存成文件
- SSH简介
- j2se小节
- CSS pitfalls and how to overcome them