Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
102883 万隽宇 扫雷游戏 C++ Wrong Answer 2 MS 284 KB 907 2024-12-26 18:23:42

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,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; char a[102][102]={}; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;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; }


Run Info:

------Input------
30 40 ???*?*???*?????????*?*??*??*???????*???? ?????*???*?*????????*???*?*?**?????????* ??*?**?*?**?????????????*???????**?????* ???*?????*???*???????????????*?????**??? ??*?*??????*?**?*?**??????**??*?*??????? ?*??*??*??***???????????**??**??????*??* ???????**???*?*???????**???????**??**??? ?*????????*???**????*?**?????*?*?????*?? ???????*??*?????*???????***??*?????**??? ????*?*??*????????*??????????*??*??????? ???**??*???????*?*???*????*???**?*?????? ?**???*??*??*????????*?*?**?*?????*???*? ??
------Answer-----
001*3*202*311000001*3*12*32*3210001*1011 01235*414*5*10000012*213*4*3**112221102* 01*3**3*4**2211000011102*3123321**22212* 023*43213*423*321222100112222*23332**111 12*4*211224*5**2*2**100123**44*2*1133211 1*23*22*32***53312221123**33**343213*21* 2221112**335*4*3100113**4211334**11**321 1*10002333*313**2101*3**43212*4*31245*10 1111122*23*20123*2121223***13*42211**210 0013*3*33*21001233*1111124322*43*2222100 123**43*3221111*2*212*3123*323**3*210111 1**322*23*32*12231114*5*3**3*23344*312*1 23210122
------Your output-----
001*3*202*311000001*3*12*32*4320001*1011 01235*414*5*10000012*213*4*3**112221102* 01*3**3*4**2211000011102*3123321**22212* 023*43213*423*321222100112222*23332**111 12*4*211224*5**2*2**100123**44*2*1133211 1*23*22*32***53312221123**33**343213*21* 2221112**335*4*3100113**4211334**11**321 1*10002333*313**2101*3**43212*4*31245*10 1111122*23*20123*2121223***13*42211**210 0013*3*33*21001233*1111124322*43*2222100 123**43*3221111*2*212*3123*323**3*210111 1**322*23*32*12231114*5*3**3*23344*312*1 23210122