(Right click on the image and select "View image" to view a larger version.)
A path in the picture above is defined as a sequence of cells such that:
If you're familiar with Path counting , this is pretty much the same definition of path as used in that problem, only made more formal.
In fact, the question is the same. Compute the number of possible paths in the picture above.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The method of solving it is largely the same as in the first version, but now with more delicate counting.
Each small grid has five possible states:
We then count each possible state carefully. In order given above, there are 1 , 1 6 , 1 5 , 2 , 9 possible ways respectively.
Now we look on each individual path of the second case. Why the second case? Because the large grid resembles exactly the second case, passing from a corner (left) to the opposite corner (right). Each of these sixteen paths correspond to the "large path" taken in the large grid, and will use the small grids in different ways, leaving them in different states. For example, consider the following path: down, right, right, up, left, down, down, right.
Considering only the states of the small grids, we can consider only this:
Thus our DRRULDDR path is essentially "1 none, 1 across, 6 adjacent, 1 twice across, 0 twice adjacent". That's all we need to consider.
Now, take a large path and consider the small grids. Suppose there are a , b , c , d , e small grids of each state respectively. That is, a small grids aren't used at all; b small grids are traversed once, across; c small grids are traversed once, to an adjacent corner; and so on. Then the corresponding number of actual path is simply 1 a ⋅ 1 6 b ⋅ 1 5 c ⋅ 2 d ⋅ 9 e . Our DRRULDDR example corresponds to 1 1 ⋅ 1 6 1 ⋅ 1 5 6 ⋅ 2 1 ⋅ 9 0 = 3 6 4 5 0 0 0 0 0 paths in total.
By computing each of the sixteen paths carefully, we arrive at the following ( a , b , c , d , e ) values and thus the number of paths contributed:
Adding all sixteen values, we obtain the answer 1 0 4 5 3 4 0 7 4 8 0 0 .