Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
102887 | 万隽宇 | 扫雷游戏 | C++ | Accepted | 4 MS | 276 KB | 928 | 2024-12-26 18:32:01 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,m,d=0,h[8]={-1,-1,-1,0,0,1,1,1},l[8]={-1,0,1,-1,1,-1,0,1}; cin>>n>>m; const int M=m; const int N=n; char a[101][101]; 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++){ d=0; if(a[i][j]=='*') cout<<a[i][j]; else{ for(int k=0;k<=7;k++){ if(a[i+h[k]][j+l[k]]=='*') d++; }cout<<d; } } cout<<endl; } return 0; }