POJ1656 Counting Black [简单暴力]
来源:互联网 发布:鹰眼数据监控 编辑:程序博客网 时间:2024/06/05 19:02
题意:
给定100*100的方格,每次涂颜色或者问颜色操作。
思路:
以为数据量太小,直接暴力模拟而过。
A水题真是一种陶冶。
#include<iostream>#include<vector>#include<string>#include<queue>#include<cmath>#include<algorithm>#define llong long long#define Min(a,b) (a<b?a:b)#define Max(a,b) (a>b?a:b)#define Abs(a) ((a)>0?(a):-(a))#define Mod(a,b) (((a)-1+(b))%(b)+1)using namespace std;int n,m;const int N=105;const int inf=99999999;char str[10];int x,y,l;int a[N][N];void cover(int x,int y,int l,int w){for(int i=y;i<=y+l-1;i++){for(int j=x;j<=x+l-1;j++){a[i][j]=w;}}}int solve(int x,int y,int l){int ans=0;for(int i=y;i<=y+l-1;i++){for(int j=x;j<=x+l-1;j++){if(a[i][j]==1)ans++;}}return ans;}int main(){scanf("%d",&m);while(m--){scanf("%s",str);scanf("%d%d%d",&x,&y,&l);if(str[0]=='B'){cover(x,y,l,1);}else if(str[0]=='W'){cover(x,y,l,2);}else{printf("%d\n",solve(x,y,l));}}return 0;}
- POJ1656 Counting Black [简单暴力]
- poj1656 Counting Black
- 北大ACM poj1656 Counting Black
- 白色网格统计poj1656-Counting Black
- Counting Black --- 暴力做法
- POJ1656
- poj1656
- POJ1656
- poj1656
- poj1656
- POJ1656
- poj1656
- POJ 1656 Counting Black
- PKU 1656 Counting black
- poj 1656 Counting Black
- POJ 1656 Counting Black
- poj 1656 Counting Black
- poj 1656 Counting Black
- jQuery-对Select的操作集合 js 得到下拉框的键值
- BI项目风险规避
- Apache与Tomcat的区别
- 自己编个bootload
- Fortran编译初步
- POJ1656 Counting Black [简单暴力]
- linux vi文本处理器(模式转换,常用命令)
- 路径规划算法总结初版
- JS取当前时间
- C和C++混合编译初步
- 模式
- Emulator Error Message - ".NET Compact Framework v2.0 could not be found."
- DataGridView删除一行数据
- Android开机运行,替换系统launch