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

Re:请教高手:我运行程序结果是对的,为什么提交显示wrong answer!

Posted by freeboy77 at 2005-03-20 01:26:31 on Problem 1656
In Reply To:请教高手:我运行程序结果是对的,为什么提交显示wrong answer! Posted by:flyinthesky at 2005-03-20 00:12:54
> struct mm { 
> 	char s[5];
> 	int x;
> 	int y;
> 	int l;
> };
> 
> #include <stdio.h>
> #include <string.h>
> 
> void main(){
> 
> 	int grid[100][100];
> 
> 	int n=1;
>     mm p[101];
>     scanf("%d",&n);
>   if(n>=1&&n<=100){ 
>    for(int t=1;t<=n;t++)
>    {scanf("%s %d %d %d",p[t].s,&(p[t].x),&(p[t].y),&(p[t].l));}
> 
> 	
>   }
>   for (int k=1;k<=n;k++){
> 	if(strcmp(p[k].s,"BLACK")==0){
> 		for(int i=p[k].x;i<=(p[k].x+p[k].l-1);i++)
> 			 for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> 				 grid[i][j]=1;
> 	 }
>  else 
>  {if(strcmp(p[k].s,"WHITE")==0){
> 		 for(int i=p[k].x;i<=(p[k].x+p[k].l)-1;i++)
> 			 for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> 				 grid[i][j]=0;
> 	 }
>    else if(strcmp(p[k].s,"TEST")==0){  
> 	   int sum=0;  
> 	   for(int i=p[k].x;i<=(p[k].x+p[k].l-1);i++)
> 		  for(int j=p[k].y;j<=(p[k].y+p[k].l-1);j++)
> 			 if (grid[i][j]==1)
> 				 sum++;
> 	      printf("%d\n",sum);
> 	}
>  }
> }
> }
> 	 
> 	 
> 	

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