過了,但,怪怪的
#include <iostream>
#define fast_as_a_fuckboy ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
fast_as_a_fuckboy;
int out[17][32] = {{0}};
char in[17][32];
for(int i = 1;i <= 15;i++){
for(int j = 1;j <= 30;j++){
cin >> in[i][j];
}
}
for(int i = 1;i <= 15;i++){
for(int j = 1;j <= 30;j++){
if(in[i][j] == '*'){
out[i][j] = '*';
if(out[i][j+1] != '*')out[i][j+1]++;
if(out[i+1][j+1] != '*')out[i+1][j+1]++;
if(out[i+1][j] != '*')out[i+1][j]++;
if(out[i-1][j+1] != '*')out[i-1][j+1]++;
if(out[i-1][j] != '*')out[i-1][j]++;
if(out[i-1][j-1] != '*')out[i-1][j-1]++;
if(out[i][j-1] != '*')out[i][j-1]++;
if(out[i+1][j-1] != '*')out[i+1][j-1]++;
}
}
}
for(int i = 1;i <= 15;i++){
for(int j = 1;j <= 30;j++){
if(out[i][j] == 0){ //沒東西
cout << ".";
}
else if(out[i][j] > 8){ //超出炸彈上限 代表他是炸彈
cout << "*";
}
else{
cout << out[i][j];
}
}
cout << "\n";
}
}