题意:
给定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;
}