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

怎么会错呢?过了样本点啊~

Posted by vvian00 at 2008-09-10 21:08:58 on Problem 3589
#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:
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