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

HAWK,给我一组让我程序错的数据吧!!!

Posted by tiankong at 2004-12-11 10:26:51 on Problem 1013
In Reply To:HAWK,给我一组让我程序错的数据吧!!! Posted by:tiankong at 2004-12-11 00:16:44
> #include<stdio.h>
> #include<string.h>
> void main()
> {
> 	char a[12]={'A','B','C','D','E','F','G','H','I','J','K','L'};
> 	char *p[]={"good","light","heavy"};
> 	int n,i,j,k,m[3],o;
> 	scanf("%d",&n);
>     
> 	while(n--)
> 	{
> 	
> 		int aa[12]={0},aaa[12]={0},r=0,wa[10]={0};
>         char x[3][10],y[3][10],blance[3][10];
>         for(j=0;j<=2;j++)
> 		{ 
> 		    
> 	         scanf("%s %s %s",x[j],y[j],blance[j]);
> 	         m[j]=strlen(x[j]);
> 	         
> 		}
> 			
> 			
> 			
> 			
> 		for(j=0;j<=2;j++)
> 		{
> 		  if(strcmp((blance[j]),"even")==0)
> 		  {
> 			for(i=0;i<=11;i++)
> 				for(k=0;k<=m[j];k++)
> 					if(a[i]==x[j][k]||a[i]==y[j][k])
> 					  aa[i]=1;
> 		  }
> 		  else
> 		  {
> 			for(i=0;i<=11;i++)
> 				for(k=0;k<=m[j];k++)
> 				{	
> 					if(a[i]==x[j][k]||a[i]==y[j][k])
> 					break;
> 				    if(k!=m[j])continue;
> 					aa[i]=1;
> 				}
> 		  }
> 		}
>         for(j=0;j<=11;j++)
> 		  if(aa[j]==0)
> 		  {wa[r]=j;r++;}
> 		
> 	    
> 		  
> 		  
> 	   for(i=0;i<=r-1;i++)	  
> 	   {	 
> 		 for(j=0;j<=3;j++)
> 		 {
> 		   if(strcmp((blance[j]),"up")==0)
> 		     for(k=0;k<=m[j];k++)
> 			   {
> 				   if(a[wa[i]]==x[j][k])
> 				   {
> 					   if(aaa[wa[i]]==0) aaa[wa[i]]=2;
> 			           if(aaa[wa[i]]==1)  goto loop;
> 				   }
> 		           if(a[wa[i]]==y[j][k])
> 				   {
> 					  if(aaa[wa[i]]==0) aaa[wa[i]]=1;
> 				       if(aaa[wa[i]]==2) goto loop;
> 				   }
> 			   }
> 		   if(strcmp((blance[j]),"down")==0)
> 		     for(k=0;k<=m[j];k++)
> 			 {
> 				   if(a[wa[i]]==x[j][k])
> 				   {
> 					   if(aaa[wa[i]]==0) aaa[wa[i]]=1;
> 				       if(aaa[wa[i]]==2) goto loop;
> 				   }
> 		           if(a[wa[i]]==y[j][k])
> 				   {
> 					   if(aaa[wa[i]]==0) aaa[wa[i]]=2;
> 			           if(aaa[wa[i]]==1)  goto loop;
> 				   }
> 			 }
> 		 }
> 	      break;
>          loop:  for (o=0;o<=11;o++)    aaa[o]=0;
> 	   }	 
> 		 
> 	   printf("%c is the counterfeit coin and it is %s.\n",a[wa[i]],p[aaa[wa[i]]]);
>       }
> }  				

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