AC
2024-11-18 16:33:07
发布于:北京
2阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
char ans[5][5],a[5][5];
bool gr[5][5];
int cnt_a[27],cnt_b[27];
int main(){
for(int i = 1;i <= 3;i++){
for(int j = 1;j <= 3;j++) cin >> ans[i][j];
}
for(int i = 1;i <= 3;i++){
for(int j = 1;j <= 3;j++) cin >> a[i][j];
}
int green = 0,yellow = 0;
for(int i = 1;i <= 3;i++) {
for(int j = 1;j <= 3;j++) {
if(ans[i][j] == a[i][j]) green++;
else{
cnt_a[ans[i][j] - 'A']++;
cnt_b[a[i][j] - 'A']++;
}
}
}
for(int i = 0;i < 26; i++) yellow += min(cnt_a[i], cnt_b[i]);
cout << green << endl << yellow;
return 0;
}
这里空空如也
有帮助,赞一个