Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
86057 | 梁敖铭 | 扫雷游戏 | C++ | Accepted | 5 MS | 316 KB | 527 | 2024-07-21 20:25:01 |
#include<iostream> using namespace std; char a[102][102]; int b[102][102]; int main() { int m,n; cin>>m>>n; for(int i=1;i<=m;++i) { for(int j=1;j<=n;++j) { cin>>a[i][j]; if(a[i][j]=='*') b[i+1][j]++,b[i][j+1]++,b[i+1][j+1]++,b[i-1][j]++,b[i-1][j-1]++,b[i][j-1]++,b[i-1][j+1]++,b[i+1][j-1]++; } } for(int i=1;i<=m;++i) { for(int j=1;j<=n;++j) { if(a[i][j]=='*') cout<<'*'; else cout<<b[i][j]; } if(i!=m) cout<<endl; } return 0; }