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

打错字了吧?里面怎么有一个"dowm"?因为打错字的wa真的很难找

Posted by frkstyc at 2005-05-16 21:58:53 on Problem 1013
In Reply To:Re:暴力穷举可以通过呀^_^为啥我的不行呢???我觉的我想的很清楚啊 Posted by:cpp051200448225 at 2005-05-16 21:45:06
> /**********************************
> 1013acm by yex 4 18 conterfeit coin
> ***********************************/
> #include<iostream.h>
> #include<string.h>
> void main()
> {
> 	int turn;
> 	int sum;
> 	char left[3][10];int ileft[3][10];
> 	char right[3][10];int iright[3][10];
> 	char result[3][7];int iresult[3];
> 	int weight[12]={0};
> 	int length[3]={0};
> 	cin>>turn ;
> 	while(turn--)
> 	{
> 		for(int count=0;count<12;count++)
> 		{
> 			weight[count]=0;
> 		}
> 		sum=0;
> 		length[0]=length[1]=length[2]=0;
> 		for(count=0;count<3;count++)
> 		{
> 			cin>>left[count]>>right[count]>>result[count];
> 			int count2;
> 			count2=0;
> 			while(left[count][count2]!='\0')
> 			{
> 				length[count]++;
> 				count2++;
> 			}
> 			int count1;
> 			for(count1=0;count1<length[count];count1++)
> 			{
> 				ileft[count][count1]=left[count][count1]-'A';
> 				iright[count][count1]=right[count][count1]-'A';
> 			}
> 			if(strcmp(result[count],"dowm")==0)
> 					iresult[count]=-1;
> 				if(strcmp(result[count],"even")==0)
> 					iresult[count]=0;
> 				if(strcmp(result[count],"up")==0)
> 					iresult[count]=1;
> 		}
> 		
> 		for(count=0;count<12;count++)
> 		{
> 			weight[count]=1;
> 			for( int count1=0;count1<3;count1++)
> 			{
> 				sum=0;
> 				for(int count2=0;count2<length[count1];count2++)
> 				{
> 					sum+=weight[ileft[count1][count2]]-weight[iright[count1][count2]];
> 				}
> 				if(sum!=iresult[count1])
> 				{
> 				weight[count]=0;break;}
> 			}
> 			if(count1==3)
> 			{
> 				cout<<char('A'+count)<<" is the counterfeit coin and it is "<<"heavy."<<endl;
> 				weight[count]=0;break;
> 			}
> 			weight[count]=-1;
> 			for( count1=0;count1<3;count1++)
> 			{
> 				sum=0;
> 				for(int count2=0;count2<length[count1];count2++)
> 				{
> 					sum+=weight[ileft[count1][count2]]-weight[iright[count1][count2]];
> 				}
> 				if(sum!=iresult[count1])
> 				{weight[count]=0;break;}
> 				
> 			}
> 			if(count1==3)
> 			{
> 				cout<<char('A'+count)<<" is the counterfeit coin and it is "<<"light."<<endl;
> 				weight[count]=0;break ;
> 			}
> 		}
> 	}
> }
> 
> 
> 				
> 
> 
> 
> 

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