Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
101825 万隽宇 扫雷游戏 C++ Time Limit Exceeded 1000 MS 268 KB 872 2024-12-19 19:35:55

Tests(0/10):


Code:

#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,k=0,c[8]={-1,-1,-1,0,0,1,1,1},d[8]={-1,0,1,-1,1,-1,0,1}; cin>>n>>m; char a[n+1][m+1]; for(int i=1;i<n;i++){ for(int j=1;j<m;j++){ cin>>a[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(a[i][j]=='*'){ cout<<'*'; } else{ for(int e=0;e<=7;k++){ if(a[i+c[e]][j+d[e]]=='*'){ k++; } } cout<<k; } } cout<<endl; } return 0; }