Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
140814 | tpx046 | 扫雷游戏 | C++ | 解答错误 | 0 | 1 MS | 304 KB | 1013 | 2024-03-31 17:34:12 |
#include<bits/stdc++.h> using namespace std; int b[105][105]; int main() { int m,n; string o; cin>>m>>n; for(int i=1;i<=m+2;i++) { for(int j=1;j<=n+2;j++) { b[i][j]=0; } } for(int i=2;i<=m+1;i++) { getline(cin,o); for(int j=2;j<=n+1;j++) { if(o[j-2]=='*') { b[i][j]=-99; b[i+1][j]++; b[i-1][j]++; b[i+1][j-1]++; b[i-1][j-1]++; b[i+1][j+1]++; b[i-1][j+1]++; b[i][j-1]++; b[i][j+1]++; } } } for(int i=2;i<=m+1;i++) { for(int j=2;j<=n+1;j++) { if(b[i][j]<0) { cout<<"*"; } else { cout<<b[i][j]; } } cout<<endl; } return 0; }