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

我已经过了SAMPLE的数据了,但是WA,不知道是为什么,哪个好心人帮我看看呀!!!谢谢了

Posted by lw8484654 at 2007-05-30 16:42:48 on Problem 1053
#include<stdio.h>
#include<string.h>

char s[20][5];

int main()
{
	int i,j,k,count=0;
	int mark,t=0;
	for(i=0;i<12;i++)
		scanf("%s",s[i]);
	printf("CARDS:  ");
	for(i=0;i<12;i++)
		printf("%s ",s[i]);
	printf("\n");
	for(i=0;i<12;i++)
	{
		mark=0;
		for(j=i+1;j<12;j++)
		{
			if(s[i][0]!=s[j][0] && s[i][1]!=s[j][1])
			{
				if(s[i][2]==s[j][2] && s[i][3]==s[j][3])mark=1;
				if(s[i][2]!=s[j][2] && s[i][3]!=s[j][3])mark=2;
				for(k=j+1;k<12;k++)
				{
					if(s[i][0]!=s[k][0] && s[j][0]!=s[k][0] && s[i][1]!=s[k][1] && s[j][1]!=s[k][1])
					{
						if(mark==1)if(s[j][2]==s[k][2] && s[j][3]==s[k][3])
						{
							count++;t=1;
							if(count==1)printf("SETS:   %d.  %s %s %s\n",count,s[i],s[j],s[k]);
							else printf("        %d.  %s %s %s\n",count,s[i],s[j],s[k]);
						}
						if(mark==2)
						if(s[j][2]!=s[k][2] && s[i][2]!=s[k][2] && s[j][3]!=s[k][3] && s[i][3]!=s[k][3])
						{count++;t=1;
							if(count==1)printf("SETS:   %d.  %s %s %s\n",count,s[i],s[j],s[k]);
							else printf("        %d.  %s %s %s\n",count,s[i],s[j],s[k]);
						}
					}
				}
			}
		}
	}
	if(!t)printf("SETS:   *** None Found ***\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