Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
307194 | 王栎州 | 【C4-12】[NOIP2015]扫雷游戏 | C++ | 通过 | 100 | 1 MS | 252 KB | 608 | 2025-01-02 20:25:09 |
#include<bits/stdc++.h> using namespace std; char a[110][110]; int main(){ int n,m,s=0; 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]=='*'){ cout<<'*'; }else{ int s=0; if(a[i-1][j-1]=='*') s++; if(a[i-1][j]=='*') s++; if(a[i-1][j+1]=='*') s++; if(a[i][j-1]=='*') s++; if(a[i][j+1]=='*') s++; if(a[i+1][j-1]=='*') s++; if(a[i+1][j]=='*') s++; if(a[i+1][j+1]=='*') s++; cout<<s; } } cout<<endl; } return 0; }