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 |
没问题啊#include <iostream> #include <stdio.h> using namespace std; int main() { int n; scanf("%d",&n); char c[6],d[6]; while(n--){ scanf("%s%s",c,d); int A=0,B=0; bool cused[4]={0},dused[4]={0}; for(int i = 0; i < 4; i++){ if(c[i]==d[i]) { A++; cused[i]=1,dused[i]=1; } } for(int i = 0; i < 4; i++){ if(cused[i])continue; for(int j = 0; j < 4; j++){ if(dused[j])continue; if(c[i]==d[j]){ B++; cused[i]=1,dused[j]=1; } } } printf("%dA%dB\n",A,B); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator