| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 87029 | sh25_zhoumy | 扫雷游戏地雷数计算 | C++ | 通过 | 0 MS | 256 KB | 868 | 2026-04-10 15:13:08 |
#include <iostream> #include <string> using namespace std; int main() { int n, m; cin >> n >> m; char a[105][105]; for (int i = 0; i < n; i++) { cin >> a[i]; } int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1}; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (a[i][j] == '*') { cout << '*'; } else { int cnt = 0; for (int d = 0; d < 8; d++) { int x = i + dx[d]; int y = j + dy[d]; if (x >= 0 && x < n && y >= 0 && y < m && a[x][y] == '*') { cnt++; } } cout << cnt; } } cout << endl; } return 0; }