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

神哪,救救我吧,TNND,why wrong answer???????????(附代码)

Posted by wangdayuno1 at 2006-02-28 20:33:58 on Problem 1013
#include<iostream.h>
char left[3][7],right[3][7],result[3][7];
char c[13]="ABCDEFGHIJKL";
int i,j,k,l,ii,jj,n;
void main()
{
	cin>>n;
	for(ii=0;ii<n;ii++)
	{
		int cc[13]={3,3,3,3,3,3,3,3,3,3,3,3,3},	ccc[13]={0,0,0,0,0,0,0,0,0,0,0,0,0},s=-10,t=10;
		for(i=0;i<3;i++)cin>>left[i]>>right[i]>>result[i];
		for(i=0;i<3;i++)
		{		s++;	t++;
			switch(result[i][0])
			{
				case 'e':for(k=0;k<7;k++)
							 for(l=0;l<12;l++)
							 {
								if(c[l]==left[i][k])cc[l]=0;					 
								if(c[l]==right[i][k])cc[l]=0;
							 }break;
				case 'u':for(k=0;k<7;k++)
						 {
							
							 for(l=0;l<12;l++) 
							{
								if(c[l]==left[i][k])
								{
									if(cc[l]==3)cc[l]=1;
									if(cc[l]==2)cc[l]=0;
									ccc[l]=s;
								}
							
								if(c[l]==right[i][k])
								{
									if(cc[l]==3)cc[l]=2;
									if(cc[l]==1)cc[l]=0;
									ccc[l]=s;
								}

							}
						 }for(l=0;l<12;l++) if(ccc[l]!=s)cc[l]=0;break;
				case 'd':for(k=0;k<7;k++)
						 {
							
							 for(l=0;l<12;l++) 
							{
								if(c[l]==left[i][k])
								{
									if(cc[l]==3)cc[l]=2;
									if(cc[l]==1)cc[l]=0;
										ccc[l]=t;
								}
								if(c[l]==right[i][k])
								{
									if(cc[l]==3)cc[l]=1;
									if(cc[l]==2)cc[l]=0;
										ccc[l]=t;
								}
							}
						 }for(l=0;l<12;l++) if(ccc[l]!=t)cc[l]=0;break;		
		  }
		}
		for(j=0;j<12;j++)
		{
			if(cc[j]==1)cout << c[j] << " is the counterfeit coin and it is heavy.\n";

			if(cc[j]==2)cout << c[j] << " is the counterfeit coin and it is light.\n";
		}
	}
}


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