| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 40767 | chenyifei | 扫雷游戏地雷数计算 | C++ | Accepted | 1 MS | 252 KB | 585 | 2024-02-16 10:01:09 |
#include<iostream> #include<cstring> using namespace std; int main() { char a[105][105]; int b[105][105]; 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=0;i<=n+1;i++){ for(int j=0;j<=m+1;j++){ if(a[i][j]=='*') b[i][j]=1; else b[i][j]=0; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(b[i][j]==0){ int c=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]; cout<<c; } else cout<<"*"; } cout<<endl; } return 0; }