Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
139540 | 凌嘉圻 | 扫雷游戏 | C++ | 通过 | 100 | 1 MS | 304 KB | 565 | 2024-03-23 17:41:23 |
#include <bits/stdc++.h> using namespace std; char a[102][102]; int b[102][102]={0}; int main() { long long n,m; cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>a[i][j]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]=='*') { b[i][j-1]++;b[i][j+1]++; b[i-1][j-1]++;b[i-1][j]++;b[i-1][j+1]++; b[i+1][j-1]++;b[i+1][j]++;b[i+1][j+1]++; } for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) if(a[i][j]!='*') cout<<b[i][j]; else cout<<"*"; cout<<endl; } return 0; }