0%

Problem 907


Problem 907


Stacking Cups

An infant’s toy consists of n cups, labelled C1,,Cn in increasing order of size.

0907_four_cups.png

The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the following means of stacking are possible:

  • Nesting: Ck may sit snugly inside Ck+1.0907_nesting.png
  • Base-to-base: Ck+2 or Ck2 may sit, right-way-up, on top of an up-side-down Ck, with their bottoms fitting together snugly.0907_base_to_base.png
  • Rim-to-rim: Ck+2 or Ck2 may sit, up-side-down, on top of a right-way-up Ck, with their tops fitting together snugly.0907_rim_to_rim.png

Define S(n) to be the number of ways to build a single tower using all n cups according to the above rules.

You are given S(4)=12, S(8)=58, and S(20)=5560.

Find S(107), giving your answer modulo 1 000 000 007.


叠杯子

某种婴儿玩具包含n个杯子,按大小递增顺序依次记为C1,,Cn

0907_four_cups.png

这些杯子可以用多种方式进行堆叠。具体来说,杯子的形状被设计为允许采用如下的堆叠方式:

  • 嵌套:Ck可以紧密地嵌套在Ck+1里面。0907_nesting.png
  • 底对底:正放的Ck+2Ck2可以放在倒置的Ck上面,并使底部紧密贴合。0907_base_to_base.png
  • 顶对顶:倒置的Ck+2Ck2可以放在正放的Ck上面,并使顶部紧密贴合。0907_rim_to_rim.png

定义S(n)为按照上述规则将所有n个杯子全部堆叠在一起的方案数目。

已知S(4)=12S(8)=58S(20)=5560

S(107),并对1 000 000 007取余作为你的答案。


Gitalking ...