Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
140539 叶航帅 扫雷游戏 Python3 Wrong Answer 31 MS 3840 KB 1135 2025-12-15 21:06:17

Tests(0/10):


Code:

mines = [ "???**", "????*", "??**?", "???*?" ] rows = len(mines) cols = len(mines[0]) b = [[0 for _ in range(cols)] for _ in range(rows)] for i in range(rows): for j in range(cols): if mines[i][j] == "*": b[i][j] = "*" else: count = 0 if i-1 >= 0 and j-1 >= 0 and mines[i-1][j-1] == "*": count += 1 if i-1 >= 0 and mines[i-1][j] == "*": count += 1 if i-1 >= 0 and j+1 < cols and mines[i-1][j+1] == "*": count += 1 if j-1 >= 0 and mines[i][j-1] == "*": count += 1 if j+1 < cols and mines[i][j+1] == "*": count += 1 if i+1 < rows and j-1 >= 0 and mines[i+1][j-1] == "*": count += 1 if i+1 < rows and mines[i+1][j] == "*": count += 1 if i+1 < rows and j+1 < cols and mines[i+1][j+1] == "*": count += 1 b[i][j] = count print("最终扫雷结果:") for row in b: print("".join(str(x) for x in row))


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-----