| ||||||||||
| 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:暑期 AC 第 五十道 水题 留念!In Reply To:暑期 AC 第 五十道 水题 留念! Posted by:jinlisu at 2010-07-18 17:38:40 > 加油!!!
#include <stdio.h>
int des[100][100],i,j,n,x,y,L;
char s[10];
int main()
{
for(i = 0;i < 100;i++)
for (j = 0;j < 100;j++)
des[i][j] == 0;
scanf("%d",&n);
while (n-- >0)
{
scanf("%s %d %d %d",s,&x,&y,&L);
if (s[0] == 'B')
for (i = x;i<x+L;i++)
for (j = y;j <y+L;j++)
des[i][j] = 1;
if (s[0] == 'W')
for (i = x;i<x+L;i++)
for (j = y;j <y+L;j++)
des[i][j] = 0;
if (s[0] == 'T')
{
int count = 0;
for (i = x;i<x+L;i++)
for (j = y;j <y+L;j++)
if (des[i][j] == 1)
count++;
printf("%d\n",count);
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator