-
个人简介
其实从出生的那一刻起,我们就在向死而生
联系方式: 小红书:娜就是我 抖音:寒樱漫雪 蛋仔(最早玩的大号):寒樱漫雪 (比大号段位高的小号):寒樱漫雪呀 QQ:2296685122 娜就是我(许琳娜) 微信:许琳娜
using namespace std; string a[105]; int ans[105][105]; int main(){ int n, m; cin >> n >> m; for (int i = 0; i < n; i++){ getline(cin, a[i]); // cout << '!'; } for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ if (a[i][j+1] != '*'){ continue; } int cnt = 0; if (a[i+1][j] == '*'){ cnt++; } if (a[i-1][j] == '*'){ cnt++; } if (a[i][j+1] == '*'){ cnt++; } if (a[i][j-1] == '*'){ cnt++; } if (a[i+1][j+1] == '*'){ cnt++; } if (a[i-1][j+1] == '*'){ cnt++; } if (a[i+1][j-1] == '*'){ cnt++; } if (a[i-1][j-1] == '*'){ cnt++; } ans[i][j] = cnt; } } for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ cout << ans[i][j]; } cout << endl; } return 0; }
-
通过的题目
-
最近活动
-
Stat
-
Rating
题目标签
- ITC
- 5
- 四级
- 3
- 蓝桥
- 2
- 十四届
- 2
- 省赛
- 2