标签:就是 ret cout 题目 ref 规律 pre href namespace
#include<bits/stdc++.h>
using namespace std;
const int N = 1005;
char a[N][N], b[N][N];
int n, m, cnt = 0;
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin >> a[i][j];
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
cin >> b[i][j];
if(a[i][j] != b[i][j]) cnt ++;
}
}
if(cnt <= (n * m) / 2)
{
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
cout << a[i][j];
}
cout << endl;
}
}
else
{
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
if(a[i][j] == ‘.‘) a[i][j] = ‘X‘;
else a[i][j] = ‘.‘;
cout << a[i][j];
}
cout << endl;
}
}
return 0;
}
ICPC2021上海区域赛 B.Mine Sweeper II(思维、构造)
标签:就是 ret cout 题目 ref 规律 pre href namespace
原文地址:https://www.cnblogs.com/K2MnO4/p/14879381.html