#10722: WA line 8939


sandaon (sandaon)

學校 : 國立中興大學
編號 : 55809
來源 : [114.24.78.88]
最後登入時間 :
2021-02-27 01:52:52
a291. nAnB problem | From: [61.216.33.23] | 發表日期 : 2016-02-24 21:43

#include <stdio.h>

int main() {

int A, B, i, j, k, l, n, pw[4];

while (scanf("%d %d %d %d", &pw[0], &pw[1], &pw[2], &pw[3]) != EOF) {
scanf("%d", &n);
int g[n][4];
for (i = 0; i < n; i++) {
scanf("%d %d %d %d", &g[i][0], &g[i][1], &g[i][2], &g[i][3]);
}
for (i = 0; i < n; i++) {
A = 0;
B = 0;
int check[4] = {0, 0, 0, 0};
int check2[4] = {0, 0, 0, 0};
for (j = 0; j < 4; j++) {
if (g[i][j] == pw[j]) {
A += 1;
check[j] = 1;
check2[j] = 1;
}
}
for (k = 0; k < 4; k++) {
if (check[k] == 0) {
for (l = 0; l < 4; l++) {
if ((check2[l] == 0)) {
if (g[i][k] == pw[l]) {
check2[l] = 1;
B += 1;
}
}
}
}
}
printf("%dA%dB\n", A, B);
}
}
return 0;
}

請問到底是哪裡出問題.......

 
ZeroJudge Forum