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<string.h> void main() { int a; int num,i,j,x,y,z,same,sum; char b[300][2]; char c[300][2]; char d[900][2]; scanf("%d",&a); for(i=0; i<a; i++) { same=0; sum=0; z=0; scanf("%d",&num); for(j=0; j<num; j++) { scanf("%s",b[j]); if(b[j][1]=='S')b[j][1]='E'; if(b[j][0]=='T')b[j][0]='F'; if(b[j][0]=='J')b[j][0]='G'; if(b[j][0]=='Q')b[j][0]='I'; if(b[j][0]=='A')b[j][0]='L'; } for(j=0; j<num; j++) { scanf("%s",c[j]); if(c[j][1]=='S')c[j][1]='E'; if(c[j][0]=='T')c[j][0]='F'; if(c[j][0]=='J')c[j][0]='G'; if(c[j][0]=='Q')c[j][0]='I'; if(c[j][0]=='A')c[j][0]='L'; } for(x=0; x<num; x++) for(y=0; y<num; y++) if(strcmp(c[y],b[x])==1) { sum++; strcpy(d[z++],c[y]); } for(x=0; x<z; x++) for(y=x+1; y<z; y++) if(d[y][0]==d[x][0]&&d[y][1]==d[x][1]&&d[y][0]!='0') {same++;d[y][0]='0';} printf("%d\n",sum-same); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator