Problem 115
Counting block combinations II
NOTE: This is a more difficult version of Problem 114.
A row measuring n units in length has red blocks with a minimum length of m units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square.
Let the fill-count function, F(m, n), represent the number of ways that a row can be filled.
For example, F(3, 29) = 673135 and F(3, 30) = 1089155.
That is, for m = 3, it can be seen that n = 30 is the smallest value for which the fill-count function first exceeds one million.
In the same way, for m = 10, it can be verified that F(10, 56) = 880711 and F(10, 57) = 1148904, so n = 57 is the least value for which the fill-count function first exceeds one million.
For m = 50, find the least value of n for which the fill-count function first exceeds one million.
方格组合计数II
注意:这是第114题一个更难的版本。
用黑色方块和最短长度为m的红色方块摆成长度为n的一行,要求任意两个红色方块(长度可以不同)之间至少有一个黑色方块。
我们用摆法计数函数F(m, n)代表符合上述要求的摆法数目。
例如,F(3, 29) = 673135以及F(3, 30) = 1089155。
也就是说,当m = 3时,可以看出n = 30是使得摆法计数函数首次超过一百万的最小值。
同样地,当m = 10时,可以验证F(10, 56) = 880711以及F(10, 57) = 1148904,因此n = 57是使得摆法计数函数首次超过一百万的最小值。
当m = 50时,求使得摆法计数函数首次超过一百万的最小n值。