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 ye at 2004-12-29 13:18:46 on Problem 1656
#include<stdio.h>
#include<string.h>
void main()
{
	int a[100][100];
	char head[20];
	int x,y,l,i,j,t,g,num=0;
	scanf("%d",&t);
	for(g=1;g<=t;g++){
		scanf("%s %d %d %d",head,&x,&y,&l);
		if(head[0]=='B'){
			for(i=x;i<=x+l-1;i++)
				for(j=y;j<=y+l-1;j++)
					a[i][j]=1;
		}
		if(head[0]=='W'){
			for(i=x;i<=x+l-1;i++)
				for(j=y;j<=y+l-1;j++)
					a[i][j]=0;
		}
		if(head[0]=='T'){
			num=0;
			for(i=x;i<=x+l-1;i++){
				for(j=y;j<=y+l-1;j++){
					if(a[i][j]==1)num++;
				}
			}
			printf("%d\n",num);
		}
	}
}

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