
130  ZOJ Monthly, January 2014  I
As a smallgame fan, Flandre loves playing the Minesweeping very much. He spends 23 hours playing the lowest level of Minesweeping every day. For example: N = 3, M = 2(# represent the mines, number means how many mines around it) # 2 1 2 # 2 4 # 3 0 # 3 # 2 0 the messages about the even columns are: 2 2 4 3 3 2 Your task is to calculate the minimum number of mines with the messages matrix.
Input
There are multiple test cases. For each test case: OutputFor each the case, print the minimum number of mines. Sample Input3 2 2 2 4 3 3 2 Sample Output4 Author: LUO, Jiewei 