#T1007. 逃少(3)
逃少(3)
Background
Li Ao(magician) is asking us a question!
Description
Li Ao is good at changing his place,he always uses this way to run away from the .But he sometimes can't use this way.To use it,he has to follow the each of the following rules:
1.LI Ao has a thing to change his body.
2.There is a changing thing near his body.
3.He and the changing thing's straight distance is less than (or the same as) k. (ATTENTION:STRAIGHT DISTANCE)
Now we give you a square ().There are 3 kinds of letters.They are '0'(means no changing things are here)、'1'(means a changing thing is here) and "-"(means where Li Ao is).Now Li Ao wants you to tell him the number of the place Li Ao can change his body and the nearest place.
Format
Input
We read m+1 lines in this problem. The first line,there are three integers,they are (, ) The lines,there are integers,they are shown the square.
Output
输出只有1行,输出里奥可以移形换位位置的个数。
Samples
4 4 2
0 0 1 0
0 + 0 1
1 0 0 1
0 1 0 1
4
6 6 4
0 0 0 1 0 0
0 0 0 0 1 0
0 0 + 0 0 0
1 0 1 0 0 1
1 0 0 1 0 1
1 1 1 1 1 1
13
Limitation
1s, 1024KiB for each test case.