0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 23:48:48 +00:00

P2670 [NOIP2015 普及组] 扫雷游戏

R63302737
This commit is contained in:
Baoshuo Ren 2021-11-21 19:06:54 +08:00 committed by Baoshuo Ren
parent 842ce30e1f
commit 59c9801478
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

33
Luogu/P2670/P2670.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <bits/stdc++.h>
using namespace std;
int n, m;
char g[105][105];
int main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> g[i] + 1;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if (g[i][j] != '*') {
int sum = 0;
sum += g[i - 1][j - 1] == '*';
sum += g[i - 1][j] == '*';
sum += g[i - 1][j + 1] == '*';
sum += g[i][j - 1] == '*';
sum += g[i][j + 1] == '*';
sum += g[i + 1][j - 1] == '*';
sum += g[i + 1][j] == '*';
sum += g[i + 1][j + 1] == '*';
cout << sum;
} else {
cout << g[i][j];
}
}
cout << endl;
}
return 0;
}