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

我已经把程序改得这么白痴了怎么还是WA啊????

Posted by 07019 at 2008-11-21 15:59:08 on Problem 3589
#include <stdio.h>
#include <stdlib.h>
void main()
{
	int n,**r,i,a,b,j,k;
	char g[5],t[5];
	scanf("%d",&n);fflush(stdin);
	r=(int**)malloc(sizeof(int*)*n);
	for (i=0;i<n;i++)
		r[i]=(int*)malloc(sizeof(int)*2);
	for (i=0;i<n;i++)
	{
		a=0;b=0;
		scanf("%s%s",g,t);fflush(stdin);
		for (j=0;j<4;j++)
		{
			if (g[j]==t[j])
				a+=1;
			else
				for (k=0;k<4;k++)
					if (t[j]==g[k])
					{b+=1;break;}
		}
		r[i][0]=a;
		r[i][1]=b;
	}
	for (i=0;i<n;i++)
		printf("%dA%dB\n",r[i][0],r[i][1]);
}

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