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 |
100题纪念!贴出代码#include <cstdio> #include <string.h> using namespace std; int main() { int T,used[256],A,B; char chs1[20],chs2[20]; scanf("%d",&T); while (T--){ scanf("%s %s",chs1,chs2); memset(used,0,sizeof(used)); for (int i=A=0;i<4;i++)A+=(chs1[i]==chs2[i]); for (int i=0;i<4;i++)used[chs1[i]]++; for (int i=B=0;i<4;i++)B+=used[chs2[i]]; printf("%dA%dB\n",A,B-A); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator