计算扫雷板的3BV
该3BV一个的扫雷委员会代表解决了板,如果你已经知道了解决方案所需的左边点击的最低数量。它代表“ Bechtel的董事会基准价值”。这是他的网站对此进行解释。 以下是已解决的扫雷板。标记表示地雷;没有地雷的图块指示相邻地雷的计数,包括对角线,除非应将“ 0”的图块留为空白。该图显示了需要单击哪些瓷砖才能解决木板。 计入3BV的点击次数为: 对于每个空白区域(相邻的零个地雷)及其非空白邻居的洪水泛滥区域之一。 互为非地砖。 另一个例子(3BV = 39) 给定2D值数组,0以获取清晰1的地雷(或布尔值),返回3BV。 一块板的尺寸至少为8x8,最大为24x30(含)。您的程序应处理所有可能的电路板,而不仅仅是示例。 注意:板永远不会仅包含地雷。 I / O示例: [[0,0,0,0,0,0,0,0], [0,0,0,1,0,0,0,0], [0,0,0,1,0,0,1,0], [0,1,0,0,1,0,0,0], [0,0,1,0,0,0,0,1], [0,0,0,1,0,0,0,0], [0,0,0,0,0,0,1,0], [0,0,0,0,0,0,0,1]] 23 [[0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0], [0,0,0,0,0,1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0], [0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,1,1,0,0,0,1,0,1,0,1,0], [0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0], [0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0], [0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1,0,1], [0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], [0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0], [0,0,0,0,0,1,0,0,0,0,0,0,0,0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