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 zzzzzz at 2004-12-10 15:56:37 on Problem 1013
#include<stdio.h>
#include<string.h>
void main()
{
	char a[12]={'A','B','C','D','E','F','G','H','I','J','K','L'};
	char x[3][10],y[3][10],blance[3][10],*p[]={"good","light","heavy"};
	int n,v=1,i,j,k,m[3],wa[10],o;
	scanf("%d",&n);
    for(j=0;j<=2;j++)
		{ 
		    for(i=0;;i++)
			{
	           scanf("%c",&x[j][i]);
	           if(x[j][i]==' ')break;
			}
	        m[j]=i-1;
	        for(i=0;;i++)
			{
	            scanf("%c",&y[j][i]);
	             if(y[j][i]==' ')break;
			}
	    
	        scanf("%s",blance[j]);
		}
	while(v<=n)
	{
	
	    int aa[12]={0},aaa[12]={0},r=0;
        
        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]]]);
      v++;
	  
	  if(v<=n)
	  for(j=0;j<=2;j++)
		{ 
		    for(i=0;;i++)
			{
	           scanf("%c",&x[j][i]);
	           if(x[j][i]==' ')break;
			}
	        m[j]=i-1;
	        for(i=0;;i++)
			{
	            scanf("%c",&y[j][i]);
	             if(y[j][i]==' ')break;
			}
	    
	        scanf("%s",blance[j]);
		}
	  
	}
}  				
	

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