照着模拟就行
AC代码
#include <iostream>
#include <cstdio>
#include <string>
#define SIZE (int)50 + 10
using namespace std;
string map[SIZE];
string fan(string);
int main() {
freopen("cpp.in", "r", stdin);
freopen("cpp.out", "w", stdout);
int n, m, x, y;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; ++i) {
cin >> map[i];
map[i] += fan(map[i]);
}
scanf("%d%d", &x, &y);
--x, --y;
for (int i = n, j = 1; i < n * 2; ++i, ++j, ++j) {
map[i] += map[i - j];
}
map[x][y] = (map[x][y] == '.') ? '#' : '.';
for (int i = 0; i < n * 2; ++i) {
cout << map[i] << endl;
}
return 0;
}
string fan(string str) {
for (int i = 0; i < str.size() / 2; ++i) {
swap(str[i], str[str.size() - i - 1]);
}
return str;
}