1390: Labyrinth
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:0
解决:0
题目描述
The labyrinth map represents a checkquered square N*N, with some checks prohibited for passing. A step in the labyrinth consists of moving from one non-prohibited check to another non-prohibited check, which has a common side with the given check. A path is some sequence of steps. It is required to move from check (1, 1) to check (N, N) in exactly K steps, that is, after K-th step appear in check (N, N). Find the amount of different ways to do it.
Note: Any check, including the starting and the ending ones, may be passed several times. The starting and the ending checks are always non-prohibited.
1 < N <= 20
0 < K <= 100
输入
The first line of the input file contains two numbers: N and K, separated by one or more spaces. The following N lines with N symbols in each contain the map of the labyrinth beginning with check (1,1). Symbol ‘0‘ marks non-prohibited checks and symbol ‘1‘ marks prohibited ones.
Process to the end of file.
输出
The output file must contain the result - the amount of possible paths of length K.
样例输入 复制
3 6
000
101
100
3 6
000
111
000
样例输出 复制
5
0