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:大牛帮帮忙,为什么WA啊

Posted by xianxingg at 2010-09-27 23:09:53 on Problem 1013
In Reply To:大牛帮帮忙,为什么WA啊 Posted by:2322 at 2010-09-05 09:38:16
> #include<iostream>
> #include<string.h>
> using namespace std;
> int main()
> {
>       char str[]={'A','B','C','D','E','F','G','H','I','J','K','L'};
>       int tru[12]={0},xx;
>       char s[10],ch;
> 	  int n,m,i,j;
> 	  cin>>m;
> 	  for(i=0;i<m;i++)
> 	  {
> 		  for(j=0;j<3;j++)
> 		  {
> 			      n=8;
> 				  while(n--)
> 				  {
> 					  cin>>ch;
> 					  for( xx=0;xx<12;xx++)
> 						  if(ch == str[xx] && tru[xx] != 2)
> 							if(n >= 4)
> 							  tru[xx]=1;
> 							else
> 							  tru[xx]=5;
> 					  
> 				  }
> 				  cin>>s;
> 				  if(strcmp("even",s) == 0)
> 					  for(xx=0;xx<12;xx++)
> 						  if(tru[xx] == 1 || tru[xx] == 5)
> 							  tru[xx]=2;
> 				 
> 					  if(strcmp("up",s) ==0)
> 						  for(xx=0;xx<12;xx++)
> 						  {
> 							  if(tru[xx]==1)
> 								  tru[xx]=4;
> 							  if(tru[xx]==5)
> 								  tru[xx]=3;
> 						  }
> 					
> 					  if(strcmp("down",s) ==0)
> 						  for(xx=0;xx<12;xx++)
> 						  {
> 							  if(tru[xx]==1)
> 								  tru[xx]=3;
> 							  if(tru[xx]==5)
> 								  tru[xx]=4;
> 						  }
> 		  }
>        for(xx=0;xx<12;xx++)
> 	   {
> 		   if(tru[xx] == 3 )
> 		   {strcpy(s,"light");break;}
> 		    if(tru[xx] == 4)
> 			  {strcpy(s,"heavy");break;}
> 			
> 	   }
> 	   cout<<str[xx]<<" is the counterfeit coin and it is "<<s<<"."<<endl;
> 
> 	  }
>      
>       return 0;
> }

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