54分,求调
查看原帖
54分,求调
1253413
wcx_is_god楼主2024/4/7 18:15

请看代码

#include <bits/stdc++.h>
using namespace std;
int main(){
	char c[5][5],z[5][5];
	int g=0,y=0,a=0;
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>z[i][j];
		}
	}
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>c[i][j];
		}
	}
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			if(c[i][j]==z[i][j]){
				g++;
				j++;
			}
			for(int k=1;k<=3;k++){
				for(int l=1;l<=3;l++){
					if(c[i][j]==z[k][l]){
						y++;
						a=1;
						break;
					}
				}
				if(a==1){
					a=0;
					break;
				}
			}
		}
	}
	cout<<g<<endl<<y; 
	return 0;
}

2024/4/7 18:15
加载中...