Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
40519 | 奚晨瑞 | 扫雷游戏地雷数计算 | C++ | Accepted | 1 MS | 264 KB | 582 | 2024-02-11 22:03:57 |
#include<iostream> using namespace std; char a[102][102]; int b[102][102]; int main() { 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){ cout<<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]; } else{ cout<<"*"; } } cout<<endl; } return 0; }