1 条题解
-
3
#include<bits/stdc++.h> using namespace std; char a[105][105]; int b[105][105],n,m; int main(){ 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]=='?'){ if(a[i-1][j-1]=='*')b[i][j]++; if(a[i][j-1]=='*')b[i][j]++; if(a[i+1][j-1]=='*')b[i][j]++; if(a[i-1][j]=='*')b[i][j]++; if(a[i+1][j]=='*')b[i][j]++; if(a[i-1][j+1]=='*')b[i][j]++; if(a[i][j+1]=='*')b[i][j]++; if(a[i+1][j+1]=='*')b[i][j]++; }else b[i][j]=-1; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ if(b[i][j]==-1)cout<<'*'; else if(b[i][j]==0x4aaec8)cout<<1; else cout<<b[i][j]; } cout<<endl; } return 0; }
- 1
信息
- ID
- 1904
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 12
- 已通过
- 10
- 上传者