| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:二维树状树组In Reply To:二维树状树组 Posted by:duhongguang at 2012-05-06 17:54:04 #include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int n,x,y,l;
int ans,ask;
char as[1100];
bool map[110][110];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
cin>>as;
scanf("%d%d%d",&x,&y,&l);
for(int i=x;i<=x+l-1;i++)
for(int j=y;j<=y+l-1;j++)
{
if(as[0]=='B')
map[i][j]=true;
if(as[0]=='W')
map[i][j]=false;
if(as[0]=='T')
{
ask=1;
if(map[i][j]==true)
ans++;
}
}
if(ask==1)
printf("%d\n",ans);
ans=ask=0;
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator