Jonly is writing his first computer game. For the opening scene he wants to have the main character, Wormly, cross Bridgely, the bridge. Wormly is a worm made of b equal circular bubbles and L legs. At all times each leg has to be under one of the bubbles, and under each bubble there can be at most one leg. Bridgely was supposed to be composed of n planks with the width of each plank equal to the diameter of each of Wormly's bubbles. However, some of the planks are missing.
At every moment, Wormly can do exactly one of the following:
- Move one of its legs forward over any number of (possibly missing) planks. After the move, the leg should be on a plank and underneath one of Wormly's bubbles. A leg isn't allowed to overtake other legs.
- Move all of its bubbles forward one plank while its legs remain on the same planks. After the move each leg must still be under one of Wormly's bubbles.
Wormly 是一条虫子,它的身体有b个球和L条腿。任何时候,它的腿总是在某个球的下方,并且每个球下方至多一条腿。
Wormly 想要过桥。这个桥由本来由n块板子组成,但有的板子不见了。
每个时刻里,wormly可以做这些事:
1、 向前移动一个脚到一块板子,要求不能越过前面的腿(图中c),不能落在消失的板子上(图中a);
2、 把所有的球向前移动一格,腿不动。移完之后,每条腿必须还在某个球下。
一开始虫在最左的b块板子上,腿在最左的L块板子上,最后虫在最右的b块板子上,腿在最右的L块板子上。这个过程最少要多少时间?