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 D_e_n_g at 2012-08-09 19:28:23 on Problem 1053
#include<stdio.h>
int main()
{
	char ch[20][10];
	int i,j,k,l,m,n;
	while(scanf("%s",ch[0])!=EOF)
	{
		for(l=0,i=1;i<12;i++)
			scanf("%s",ch[i]);
		printf("CARDS:  %s",ch[0]);
		for(i=1;i<12;i++) printf(" %s",ch[i]);
		printf("\n");
		for(i=0;i<10;i++)
			for(j=i+1;j<11;j++)
				for(k=j+1;k<12;k++)
				{
					for(n=m=0;m<4;m++)
						if((ch[i][m]==ch[j][m]&&ch[i][m]==ch[k][m])||(ch[i][m]!=ch[j][m]&&ch[i][m]!=ch[k][m]&&ch[j][m]!=ch[k][m])) n++;
					if(n!=4) continue;
					if(!l) printf("SETS:   %d.  %s %s %s\n",++l,ch[i],ch[j],ch[k]);
					else printf("        %d.  %s %s %s\n",++l,ch[i],ch[j],ch[k]);
				}
		if(!l) printf("SETS:   *** None Found ***");
		printf("\n");
	}
	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