| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 37190 | 于俊杰 | 扫雷游戏 | C++ | Accepted | 4 MS | 288 KB | 622 | 2022-08-13 10:48:51 |
#include<iostream> using namespace std; int main(){ char a[101][101]; int 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++){ int s=0; if(a[i][j]=='*') cout<<'*'; else{ if(a[i+1][j]=='*') s++; if(a[i+1][j+1]=='*') s++; if(a[i][j+1]=='*') s++; if(a[i-1][j]=='*') s++; if(a[i-1][j-1]=='*') s++; if(a[i-1][j+1]=='*') s++; if(a[i][j-1]=='*') s++; if(a[i+1][j-1]=='*') s++; cout<<s; } } cout<<endl; } return 0; }