蹬高游戏
蹬高台阶共35级,每次可以蹬 2 级或 3 级,个位数是 4 的不能蹬,个位数是 8 的必须蹬,问有多少种蹬法? 母函数加排除法 你们真的觉得论坛里爬楼梯的题目不够多吗
逢8必蹬,于是中间段是$x^n$,前后段生成函数计算,相乘。 真的觉得论坛里爬楼梯的题目不够多吗 倪举鹏 发表于 2019-4-12 11:56
母函数加排除法
期待大佬写程序 本帖最后由 王守恩 于 2019-4-13 06:41 编辑
markfang2050 发表于 2019-4-12 18:51
期待大佬写程序
谢谢 zeroieme ! 逢\(\ \ 8\ \ \)必蹬!于是中间段是\(\ \ x^n\),前后段生成函数计算,相乘。
前段:第 1 级到第 8 级有 3 种蹬法,
中间段:分2节,8——18——28,每节有 5 种蹬法,
后段:第 28 级到第 35 级有 3 种蹬法,
合计:3×5^2×3=225 种蹬法。
程序计算得
-------------------
225 {{2, 5, 8, 10, 12, 15, 18, 20, 22, 25, 28, 30, 32, 35}, {2, 5, 8, 10,
12, 15, 18, 20, 22, 25, 28, 30, 33, 35}, {2, 5, 8, 10, 12, 15, 18,
20, 22, 25, 28, 31, 33, 35}, {2, 5, 8, 10, 12, 15, 18, 20, 23, 25,
28, 30, 32, 35}, {2, 5, 8, 10, 12, 15, 18, 20, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 10, 12, 15, 18, 20, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 10, 12, 15, 18, 20, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 10, 12,
15, 18, 20, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 10, 12, 15, 18, 20,
23, 26, 28, 31, 33, 35}, {2, 5, 8, 10, 12, 15, 18, 21, 23, 25, 28,
30, 32, 35}, {2, 5, 8, 10, 12, 15, 18, 21, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 10, 12, 15, 18, 21, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 10, 12, 15, 18, 21, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 10, 12,
15, 18, 21, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 10, 12, 15, 18, 21,
23, 26, 28, 31, 33, 35}, {2, 5, 8, 10, 13, 15, 18, 20, 22, 25, 28,
30, 32, 35}, {2, 5, 8, 10, 13, 15, 18, 20, 22, 25, 28, 30, 33,
35}, {2, 5, 8, 10, 13, 15, 18, 20, 22, 25, 28, 31, 33, 35}, {2, 5,
8, 10, 13, 15, 18, 20, 23, 25, 28, 30, 32, 35}, {2, 5, 8, 10, 13,
15, 18, 20, 23, 25, 28, 30, 33, 35}, {2, 5, 8, 10, 13, 15, 18, 20,
23, 25, 28, 31, 33, 35}, {2, 5, 8, 10, 13, 15, 18, 20, 23, 26, 28,
30, 32, 35}, {2, 5, 8, 10, 13, 15, 18, 20, 23, 26, 28, 30, 33,
35}, {2, 5, 8, 10, 13, 15, 18, 20, 23, 26, 28, 31, 33, 35}, {2, 5,
8, 10, 13, 15, 18, 21, 23, 25, 28, 30, 32, 35}, {2, 5, 8, 10, 13,
15, 18, 21, 23, 25, 28, 30, 33, 35}, {2, 5, 8, 10, 13, 15, 18, 21,
23, 25, 28, 31, 33, 35}, {2, 5, 8, 10, 13, 15, 18, 21, 23, 26, 28,
30, 32, 35}, {2, 5, 8, 10, 13, 15, 18, 21, 23, 26, 28, 30, 33,
35}, {2, 5, 8, 10, 13, 15, 18, 21, 23, 26, 28, 31, 33, 35}, {2, 5,
8, 10, 13, 16, 18, 20, 22, 25, 28, 30, 32, 35}, {2, 5, 8, 10, 13,
16, 18, 20, 22, 25, 28, 30, 33, 35}, {2, 5, 8, 10, 13, 16, 18, 20,
22, 25, 28, 31, 33, 35}, {2, 5, 8, 10, 13, 16, 18, 20, 23, 25, 28,
30, 32, 35}, {2, 5, 8, 10, 13, 16, 18, 20, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 10, 13, 16, 18, 20, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 10, 13, 16, 18, 20, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 10, 13,
16, 18, 20, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 10, 13, 16, 18, 20,
23, 26, 28, 31, 33, 35}, {2, 5, 8, 10, 13, 16, 18, 21, 23, 25, 28,
30, 32, 35}, {2, 5, 8, 10, 13, 16, 18, 21, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 10, 13, 16, 18, 21, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 10, 13, 16, 18, 21, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 10, 13,
16, 18, 21, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 10, 13, 16, 18, 21,
23, 26, 28, 31, 33, 35}, {2, 5, 8, 11, 13, 15, 18, 20, 22, 25, 28,
30, 32, 35}, {2, 5, 8, 11, 13, 15, 18, 20, 22, 25, 28, 30, 33,
35}, {2, 5, 8, 11, 13, 15, 18, 20, 22, 25, 28, 31, 33, 35}, {2, 5,
8, 11, 13, 15, 18, 20, 23, 25, 28, 30, 32, 35}, {2, 5, 8, 11, 13,
15, 18, 20, 23, 25, 28, 30, 33, 35}, {2, 5, 8, 11, 13, 15, 18, 20,
23, 25, 28, 31, 33, 35}, {2, 5, 8, 11, 13, 15, 18, 20, 23, 26, 28,
30, 32, 35}, {2, 5, 8, 11, 13, 15, 18, 20, 23, 26, 28, 30, 33,
35}, {2, 5, 8, 11, 13, 15, 18, 20, 23, 26, 28, 31, 33, 35}, {2, 5,
8, 11, 13, 15, 18, 21, 23, 25, 28, 30, 32, 35}, {2, 5, 8, 11, 13,
15, 18, 21, 23, 25, 28, 30, 33, 35}, {2, 5, 8, 11, 13, 15, 18, 21,
23, 25, 28, 31, 33, 35}, {2, 5, 8, 11, 13, 15, 18, 21, 23, 26, 28,
30, 32, 35}, {2, 5, 8, 11, 13, 15, 18, 21, 23, 26, 28, 30, 33,
35}, {2, 5, 8, 11, 13, 15, 18, 21, 23, 26, 28, 31, 33, 35}, {2, 5,
8, 11, 13, 16, 18, 20, 22, 25, 28, 30, 32, 35}, {2, 5, 8, 11, 13,
16, 18, 20, 22, 25, 28, 30, 33, 35}, {2, 5, 8, 11, 13, 16, 18, 20,
22, 25, 28, 31, 33, 35}, {2, 5, 8, 11, 13, 16, 18, 20, 23, 25, 28,
30, 32, 35}, {2, 5, 8, 11, 13, 16, 18, 20, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 11, 13, 16, 18, 20, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 11, 13, 16, 18, 20, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 11, 13,
16, 18, 20, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 11, 13, 16, 18, 20,
23, 26, 28, 31, 33, 35}, {2, 5, 8, 11, 13, 16, 18, 21, 23, 25, 28,
30, 32, 35}, {2, 5, 8, 11, 13, 16, 18, 21, 23, 25, 28, 30, 33,
35}, {2, 5, 8, 11, 13, 16, 18, 21, 23, 25, 28, 31, 33, 35}, {2, 5,
8, 11, 13, 16, 18, 21, 23, 26, 28, 30, 32, 35}, {2, 5, 8, 11, 13,
16, 18, 21, 23, 26, 28, 30, 33, 35}, {2, 5, 8, 11, 13, 16, 18, 21,
23, 26, 28, 31, 33, 35}, {3, 5, 8, 10, 12, 15, 18, 20, 22, 25, 28,
30, 32, 35}, {3, 5, 8, 10, 12, 15, 18, 20, 22, 25, 28, 30, 33,
35}, {3, 5, 8, 10, 12, 15, 18, 20, 22, 25, 28, 31, 33, 35}, {3, 5,
8, 10, 12, 15, 18, 20, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 10, 12,
15, 18, 20, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 10, 12, 15, 18, 20,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 10, 12, 15, 18, 20, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 10, 12, 15, 18, 20, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 10, 12, 15, 18, 20, 23, 26, 28, 31, 33, 35}, {3, 5,
8, 10, 12, 15, 18, 21, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 10, 12,
15, 18, 21, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 10, 12, 15, 18, 21,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 10, 12, 15, 18, 21, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 10, 12, 15, 18, 21, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 10, 12, 15, 18, 21, 23, 26, 28, 31, 33, 35}, {3, 5,
8, 10, 13, 15, 18, 20, 22, 25, 28, 30, 32, 35}, {3, 5, 8, 10, 13,
15, 18, 20, 22, 25, 28, 30, 33, 35}, {3, 5, 8, 10, 13, 15, 18, 20,
22, 25, 28, 31, 33, 35}, {3, 5, 8, 10, 13, 15, 18, 20, 23, 25, 28,
30, 32, 35}, {3, 5, 8, 10, 13, 15, 18, 20, 23, 25, 28, 30, 33,
35}, {3, 5, 8, 10, 13, 15, 18, 20, 23, 25, 28, 31, 33, 35}, {3, 5,
8, 10, 13, 15, 18, 20, 23, 26, 28, 30, 32, 35}, {3, 5, 8, 10, 13,
15, 18, 20, 23, 26, 28, 30, 33, 35}, {3, 5, 8, 10, 13, 15, 18, 20,
23, 26, 28, 31, 33, 35}, {3, 5, 8, 10, 13, 15, 18, 21, 23, 25, 28,
30, 32, 35}, {3, 5, 8, 10, 13, 15, 18, 21, 23, 25, 28, 30, 33,
35}, {3, 5, 8, 10, 13, 15, 18, 21, 23, 25, 28, 31, 33, 35}, {3, 5,
8, 10, 13, 15, 18, 21, 23, 26, 28, 30, 32, 35}, {3, 5, 8, 10, 13,
15, 18, 21, 23, 26, 28, 30, 33, 35}, {3, 5, 8, 10, 13, 15, 18, 21,
23, 26, 28, 31, 33, 35}, {3, 5, 8, 10, 13, 16, 18, 20, 22, 25, 28,
30, 32, 35}, {3, 5, 8, 10, 13, 16, 18, 20, 22, 25, 28, 30, 33,
35}, {3, 5, 8, 10, 13, 16, 18, 20, 22, 25, 28, 31, 33, 35}, {3, 5,
8, 10, 13, 16, 18, 20, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 10, 13,
16, 18, 20, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 10, 13, 16, 18, 20,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 10, 13, 16, 18, 20, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 10, 13, 16, 18, 20, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 10, 13, 16, 18, 20, 23, 26, 28, 31, 33, 35}, {3, 5,
8, 10, 13, 16, 18, 21, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 10, 13,
16, 18, 21, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 10, 13, 16, 18, 21,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 10, 13, 16, 18, 21, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 10, 13, 16, 18, 21, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 10, 13, 16, 18, 21, 23, 26, 28, 31, 33, 35}, {3, 5,
8, 11, 13, 15, 18, 20, 22, 25, 28, 30, 32, 35}, {3, 5, 8, 11, 13,
15, 18, 20, 22, 25, 28, 30, 33, 35}, {3, 5, 8, 11, 13, 15, 18, 20,
22, 25, 28, 31, 33, 35}, {3, 5, 8, 11, 13, 15, 18, 20, 23, 25, 28,
30, 32, 35}, {3, 5, 8, 11, 13, 15, 18, 20, 23, 25, 28, 30, 33,
35}, {3, 5, 8, 11, 13, 15, 18, 20, 23, 25, 28, 31, 33, 35}, {3, 5,
8, 11, 13, 15, 18, 20, 23, 26, 28, 30, 32, 35}, {3, 5, 8, 11, 13,
15, 18, 20, 23, 26, 28, 30, 33, 35}, {3, 5, 8, 11, 13, 15, 18, 20,
23, 26, 28, 31, 33, 35}, {3, 5, 8, 11, 13, 15, 18, 21, 23, 25, 28,
30, 32, 35}, {3, 5, 8, 11, 13, 15, 18, 21, 23, 25, 28, 30, 33,
35}, {3, 5, 8, 11, 13, 15, 18, 21, 23, 25, 28, 31, 33, 35}, {3, 5,
8, 11, 13, 15, 18, 21, 23, 26, 28, 30, 32, 35}, {3, 5, 8, 11, 13,
15, 18, 21, 23, 26, 28, 30, 33, 35}, {3, 5, 8, 11, 13, 15, 18, 21,
23, 26, 28, 31, 33, 35}, {3, 5, 8, 11, 13, 16, 18, 20, 22, 25, 28,
30, 32, 35}, {3, 5, 8, 11, 13, 16, 18, 20, 22, 25, 28, 30, 33,
35}, {3, 5, 8, 11, 13, 16, 18, 20, 22, 25, 28, 31, 33, 35}, {3, 5,
8, 11, 13, 16, 18, 20, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 11, 13,
16, 18, 20, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 11, 13, 16, 18, 20,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 11, 13, 16, 18, 20, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 11, 13, 16, 18, 20, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 11, 13, 16, 18, 20, 23, 26, 28, 31, 33, 35}, {3, 5,
8, 11, 13, 16, 18, 21, 23, 25, 28, 30, 32, 35}, {3, 5, 8, 11, 13,
16, 18, 21, 23, 25, 28, 30, 33, 35}, {3, 5, 8, 11, 13, 16, 18, 21,
23, 25, 28, 31, 33, 35}, {3, 5, 8, 11, 13, 16, 18, 21, 23, 26, 28,
30, 32, 35}, {3, 5, 8, 11, 13, 16, 18, 21, 23, 26, 28, 30, 33,
35}, {3, 5, 8, 11, 13, 16, 18, 21, 23, 26, 28, 31, 33, 35}, {3, 6,
8, 10, 12, 15, 18, 20, 22, 25, 28, 30, 32, 35}, {3, 6, 8, 10, 12,
15, 18, 20, 22, 25, 28, 30, 33, 35}, {3, 6, 8, 10, 12, 15, 18, 20,
22, 25, 28, 31, 33, 35}, {3, 6, 8, 10, 12, 15, 18, 20, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 10, 12, 15, 18, 20, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 10, 12, 15, 18, 20, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 10, 12, 15, 18, 20, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 10, 12,
15, 18, 20, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 10, 12, 15, 18, 20,
23, 26, 28, 31, 33, 35}, {3, 6, 8, 10, 12, 15, 18, 21, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 10, 12, 15, 18, 21, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 10, 12, 15, 18, 21, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 10, 12, 15, 18, 21, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 10, 12,
15, 18, 21, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 10, 12, 15, 18, 21,
23, 26, 28, 31, 33, 35}, {3, 6, 8, 10, 13, 15, 18, 20, 22, 25, 28,
30, 32, 35}, {3, 6, 8, 10, 13, 15, 18, 20, 22, 25, 28, 30, 33,
35}, {3, 6, 8, 10, 13, 15, 18, 20, 22, 25, 28, 31, 33, 35}, {3, 6,
8, 10, 13, 15, 18, 20, 23, 25, 28, 30, 32, 35}, {3, 6, 8, 10, 13,
15, 18, 20, 23, 25, 28, 30, 33, 35}, {3, 6, 8, 10, 13, 15, 18, 20,
23, 25, 28, 31, 33, 35}, {3, 6, 8, 10, 13, 15, 18, 20, 23, 26, 28,
30, 32, 35}, {3, 6, 8, 10, 13, 15, 18, 20, 23, 26, 28, 30, 33,
35}, {3, 6, 8, 10, 13, 15, 18, 20, 23, 26, 28, 31, 33, 35}, {3, 6,
8, 10, 13, 15, 18, 21, 23, 25, 28, 30, 32, 35}, {3, 6, 8, 10, 13,
15, 18, 21, 23, 25, 28, 30, 33, 35}, {3, 6, 8, 10, 13, 15, 18, 21,
23, 25, 28, 31, 33, 35}, {3, 6, 8, 10, 13, 15, 18, 21, 23, 26, 28,
30, 32, 35}, {3, 6, 8, 10, 13, 15, 18, 21, 23, 26, 28, 30, 33,
35}, {3, 6, 8, 10, 13, 15, 18, 21, 23, 26, 28, 31, 33, 35}, {3, 6,
8, 10, 13, 16, 18, 20, 22, 25, 28, 30, 32, 35}, {3, 6, 8, 10, 13,
16, 18, 20, 22, 25, 28, 30, 33, 35}, {3, 6, 8, 10, 13, 16, 18, 20,
22, 25, 28, 31, 33, 35}, {3, 6, 8, 10, 13, 16, 18, 20, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 10, 13, 16, 18, 20, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 10, 13, 16, 18, 20, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 10, 13, 16, 18, 20, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 10, 13,
16, 18, 20, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 10, 13, 16, 18, 20,
23, 26, 28, 31, 33, 35}, {3, 6, 8, 10, 13, 16, 18, 21, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 10, 13, 16, 18, 21, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 10, 13, 16, 18, 21, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 10, 13, 16, 18, 21, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 10, 13,
16, 18, 21, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 10, 13, 16, 18, 21,
23, 26, 28, 31, 33, 35}, {3, 6, 8, 11, 13, 15, 18, 20, 22, 25, 28,
30, 32, 35}, {3, 6, 8, 11, 13, 15, 18, 20, 22, 25, 28, 30, 33,
35}, {3, 6, 8, 11, 13, 15, 18, 20, 22, 25, 28, 31, 33, 35}, {3, 6,
8, 11, 13, 15, 18, 20, 23, 25, 28, 30, 32, 35}, {3, 6, 8, 11, 13,
15, 18, 20, 23, 25, 28, 30, 33, 35}, {3, 6, 8, 11, 13, 15, 18, 20,
23, 25, 28, 31, 33, 35}, {3, 6, 8, 11, 13, 15, 18, 20, 23, 26, 28,
30, 32, 35}, {3, 6, 8, 11, 13, 15, 18, 20, 23, 26, 28, 30, 33,
35}, {3, 6, 8, 11, 13, 15, 18, 20, 23, 26, 28, 31, 33, 35}, {3, 6,
8, 11, 13, 15, 18, 21, 23, 25, 28, 30, 32, 35}, {3, 6, 8, 11, 13,
15, 18, 21, 23, 25, 28, 30, 33, 35}, {3, 6, 8, 11, 13, 15, 18, 21,
23, 25, 28, 31, 33, 35}, {3, 6, 8, 11, 13, 15, 18, 21, 23, 26, 28,
30, 32, 35}, {3, 6, 8, 11, 13, 15, 18, 21, 23, 26, 28, 30, 33,
35}, {3, 6, 8, 11, 13, 15, 18, 21, 23, 26, 28, 31, 33, 35}, {3, 6,
8, 11, 13, 16, 18, 20, 22, 25, 28, 30, 32, 35}, {3, 6, 8, 11, 13,
16, 18, 20, 22, 25, 28, 30, 33, 35}, {3, 6, 8, 11, 13, 16, 18, 20,
22, 25, 28, 31, 33, 35}, {3, 6, 8, 11, 13, 16, 18, 20, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 11, 13, 16, 18, 20, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 11, 13, 16, 18, 20, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 11, 13, 16, 18, 20, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 11, 13,
16, 18, 20, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 11, 13, 16, 18, 20,
23, 26, 28, 31, 33, 35}, {3, 6, 8, 11, 13, 16, 18, 21, 23, 25, 28,
30, 32, 35}, {3, 6, 8, 11, 13, 16, 18, 21, 23, 25, 28, 30, 33,
35}, {3, 6, 8, 11, 13, 16, 18, 21, 23, 25, 28, 31, 33, 35}, {3, 6,
8, 11, 13, 16, 18, 21, 23, 26, 28, 30, 32, 35}, {3, 6, 8, 11, 13,
16, 18, 21, 23, 26, 28, 30, 33, 35}, {3, 6, 8, 11, 13, 16, 18, 21,
23, 26, 28, 31, 33, 35}}
225种登高方案。@守恩王:lol
页:
[1]