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 skyatmoon at 2017-01-14 22:13:14 on Problem 1013
#include<stdio.h>
#include<string.h>
int main()
{
int a[13],n,i,j,k,h,m,d[13],p,t;
char b,c[6],e[5],f[5],q;
scanf("%d",&n);
for(i=0;i<n;++i)
{
	for(h=0;h<3;++h)
	{
	
	scanf("%s",&e);
	scanf("%s",&f);
	scanf("%s",&c);
switch(c[0])
{
	case 'e':
	for(j=0;j<4;j++)
	{
		b=e[j];
			switch(b)
{
	case 'A':;break;
	case 'B':;break;
	case 'C':;break;
	case 'D':;break;
	case 'E':;break;
	case 'F':;break;
	case 'G':a[7]=0;break;
	case 'H':a[8]=0;break;
	case 'I':a[9]=0;break;
	case 'J':a[10]=0;break;
	case 'K':a[11]=0;break;
	case 'L':a[12]=0;break;	

	}
	}
	for(j=0;j<4;j++)
	{
		b=f[j];
			switch(b)
{
	case 'A':a[1]=0;break;
	case 'B':a[2]=0;break;
	case 'C':a[3]=0;break;
	case 'D':a[4]=0;break;
	case 'E':a[5]=0;break;
	case 'F':a[6]=0;break;
	case 'G':a[7]=0;break;
	case 'H':a[8]=0;break;
	case 'I':a[9]=0;break;
	case 'J':a[10]=0;break;
	case 'K':a[11]=0;break;
	case 'L':a[12]=0;break;	

	}
	
	}break;
case 'u':
for(j=0;j<4;j++)
	{
		b=e[j];
			switch(b)
{
	case 'A':a[1]++;break;
	case 'B':a[2]++;break;
	case 'C':a[3]++;break;
	case 'D':a[4]++;break;
	case 'E':a[5]++;break;
	case 'F':a[6]++;break;
	case 'G':a[7]++;break;
	case 'H':a[8]++;break;
	case 'I':a[9]++;break;
	case 'J':a[10]++;break;
	case 'K':a[11]++;break;
	case 'L':a[12]++;break;	

	}
	
	}break;
	case 'd':
	for(j=0;j<4;j++)
	{
		b=f[j];
			switch(b)
{
	case 'A':a[1]++;break;
	case 'B':a[2]++;break;
	case 'C':a[3]++;break;
	case 'D':a[4]++;break;
	case 'E':a[5]++;break;
	case 'F':a[6]++;break;
	case 'G':a[7]++;break;
	case 'H':a[8]++;break;
	case 'I':a[9]++;break;
	case 'J':a[10]++;break;
	case 'K':a[11]++;break;
	case 'L':a[12]++;break;	

	}
	
	}break;	
}
}
for(m=1;m<13;++m) d[m]=a[m];
for(j=0;j<13;++j)
for(k=j;k<12;++k)
{
	if(a[k]>a[k+1])
	a[k]=a[k]^a[k+1];
	a[k+1]=a[k]^a[k+1];
	a[k]=a[k]^a[k+1];	
}
for(m=1;m<13;++m)
for(p=1;p<13;++p)
if(d[m]==a[p])
{
	t=m;
	break;
}
switch(t)
{
	case 1:q='A';break;
	case 2:q='B';break;
	case 3:q='C';break;
	case 4:q='D';break;
	case 5:q='E';break;
	case 6:q='F';break;
	case 7:q='G';break;
	case 8:q='H';break;
	case 9:q='I';break;
	case 10:q='J';break;
	case 11:q='K';break;
	case 12:q='L';break;	

	}
printf("%c is the counterfeit coin and it is light.\n",q);

}

	
	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