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

100题纪念!贴出代码

Posted by fanhqme at 2008-10-01 18:35:28 on Problem 3589
#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:
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