| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我已经把程序改得这么白痴了怎么还是WA啊????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator