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> using namespace std; int n; int i, j, k; char N1[8], N2[8]; int A, B; int main(){ scanf("%d", &n); for(i = 0; i < n; ++ i){ scanf("%s%s", N1, N2); B = 0; A = 0; for (j = 0; j < 4; ++ j){ if(N1[j] == N2[j]) ++ A; } sort(N1, N1 + 4); sort(N2, N2 + 4); for (k = 0; k < 4; ++ k){ if(N1[k] == N2[k]) ++ B; } 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