POJ1656
来源:互联网 发布:qos网络应用 编辑:程序博客网 时间:2024/06/11 00:31
摘要:貌似水题越来越少了,好不容易才找到一题。。。
#include <iostream>
using namespace std;
const int size = 100;
int array[size+1][size+1] = { 0 };
void operation(string command, int x1, int y1, int x2, int y2)
{
if( command == "BLACK" ){
for(int i=x1; i<=x2; i++){
for(int j=y1; j<=y2; j++){
array[i][j] = 1;
}
}
}
if( command == "WHITE" ){
for(int i=x1; i<=x2; i++){
for(int j=y1; j<=y2; j++){
array[i][j] = 0;
}
}
}
int black = 0;
if( command == "TEST" ){
for(int i=x1; i<=x2; i++){
for(int j=y1; j<=y2; j++){
black += array[i][j];
}
}
cout << black << endl;
}
}
int main()
{
int n;
cin >> n;
while( n > 0 ){
string command;
int x1, y1, l;
cin >> command;
cin >> x1 >> y1 >> l;
int x2 = x1+l-1;
int y2 = y1+l-1;
operation(command, x1, y1, x2, y2);
n--;
}
return 0;
}
- POJ1656
- poj1656
- POJ1656
- poj1656
- poj1656
- POJ1656
- poj1656
- poj1656----二维线段树
- poj1656 Counting Black
- poj1656 二维树状数组
- POJ1656 Counting Black [简单暴力]
- 北大ACM poj1656 Counting Black
- poj1656作为新手我都觉得水!!
- 白色网格统计poj1656-Counting Black
- UBUNTU与QT.
- 3.7.1 打印出所有的“水仙花数”,所谓“水仙花数”是指一个3位数,其各位数字立方和等于该数本身。
- 普洱茶价格
- 不找借口找方法——成功者都有的基本素质
- 我是新手
- POJ1656
- 动画效果鼠标点击打开/关闭层
- 换个角度来解决问题
- 对C/C++中多维数组指针的理解
- 三种主流的JVM(JDK)使用心得
- 项目进度落后问题解决
- 人力资源管理中的风险管理
- SEO两百个秘密:如何生成Google Sitelinks?
- 循环嵌套优化!!