Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这是怎么了?

Posted by chenxuan123456789 at 2012-07-30 09:09:06 on Problem 1656
#include <stdio.h>
#include <string.h>
#define N 100+10
int chess[N][N];
int main()
{
	int n,x,y,l,i,j,count,k;
	char op[10];
	scanf("%d",&n);
	memset(chess,0,sizeof(chess));
	for(k=1;k<=n;k++)
	{
		scanf("%s %d %d %d\n",op,&x,&y,&l);
		switch(op[0])
		{
		case'B':
			{
			for(i=x;i<=x+l-1;x++)
			for(j=y;j<=y+l-1;j++)
			chess[i][j]=1;
			break;
			}
		case 'W':
			{
				for(i=x;i<=x+l-1;x++)
			      for(j=y;j<=y+l-1;j++)
			         	chess[i][j]=0;
			break;
			}
		case 'T':
			{
	   count=0;
	   for(i=x;i<=x+l-1;i++)
		 for(j=y;j<=y+l-1;j++)
			if(chess[i][j])
			count++;
			printf("%d\n",count);
			break;
			}
		}
	}
 return 1;
}



Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator