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 90401540 at 2005-01-02 22:17:07 on Problem 1656
#include<stdio.h>
#include<math.h>
void main()
{int t,i,j,x,y,l,k,n=0;
char A[5];
int a[110][110];
   for(i=1;i<101;i++)
	   for(j=1;j<101;j++)
		   a[i][j]=0;
   scanf("%d\n",&t);
 for(k=0;k<t;k++){
	 scanf("%s%d%d%d\n",A,&x,&y,&l);
	 if(A[0]=='B')
		 for(i=x;i<x+l;i++)
			 for(j=y;j<y+l;j++)
				 a[i][j]=1;
	 if(A[0]=='W')
		 for(i=x;i<x+l;i++)
			 for(j=y;j<y+l;j++)
                 a[i][j]=0;
			 if(A[0]=='T'){
         for(i=x;i<x+l;i++)
			 for(j=y;j<y+l;j++)
				 if(a[i][j]=1)
					 n=n+1;
				 printf("%d",n);}
				
 }
	 }

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