Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
101828 万隽宇 扫雷游戏 C++ Wrong Answer 2 MS 272 KB 869 2024-12-19 19:40:28

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][m]; 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++){ if(a[i][j]=='*'){ cout<<'*'; } else{ for(int e=0;e<=7;e++){ if(a[i+c[e]] [j+d[e]]=='*'){ k++; } } cout<<k; } } 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*4*668*111213131313131314*17*1820*2325*28303131313132*33333435 3637394247*515256*61*6262626262626365*676871*75*78**798082848687888890* 9293*96**99*103**105107108109109109109109110111112112114*117118120123126128129**131133135136138* 140142145*149152154155158*162164167*170172173175177179180180180181182184186188190*192195198201203**204205206 208210*214*216217218220222226*231**233*235**236236236237239242**246250*252*253254257260262263264 266*268271*273275*278280***28528829129229429629829930030230