|
EXAMPLE
|
There are no knight's moves from (0, 1) which decrease the Manhattan distance, so T(0, 1) = 0.
From (1, 3) you can reach the origin by (-1, 2) -> (0, 0) or (2, 1) -> (0, 0), hence T(1, 3) = 2.
From (2, 3) the possible routes are:
(0, 4) -> (-1, 2) -> (0, 0)
(0, 4) -> (1, 2) -> (0, 0)
(3, 1) -> (1, 2) -> (0, 0)
(3, 1) -> (2, -1) -> (0, 0)
Hence T(2, 3) = 4.
Array begins:
m=0 1 2 3 4 5 6 7 8 9 10
+---------------------------------------------------------------------------
n=0| 1, 0, 0, 0, 2, 4, 4, 12, 34, 70, 148, ...
1| 0, 0, 1, 2, 2, 6, 17, 35, 74, 170, 389, ...
2| 0, 1, 0, 4, 9, 14, 35, 84, 185, 412, 929, ...
3| 0, 2, 4, 6, 17, 40, 86, 195, 445, 1013, 2284, ...
4| 2, 2, 9, 17, 36, 90, 205, 466, 1058, 2406, 5491, ...
5| 4, 6, 14, 40, 90, 206, 476, 1097, 2525, 5761, 13140, ...
6| 4, 17, 35, 86, 205, 476, 1112, 2566, 5914, 13648, 31273, ...
7| 12, 35, 84, 195, 466, 1097, 2566, 6002, 13884, 32115, 74129, ...
8| 34, 74, 185, 445, 1058, 2525, 5914, 13884, 32428, 75304, 174436, ...
9| 70, 170, 412, 1013, 2406, 5761, 13648, 32115, 75304, 176026, 409435, ...
10|148, 389, 929, 2284, 5491, 13140, 31273, 74129, 174436, 409435, 957106, ...
|