作者KitWoolsey (难得好天气)
看板Prob_Solve
标题[问题] CS touring center : stepping stone (递回?)
时间Mon Mar 28 23:50:28 2011
http://tinyurl.com/eggsandspam
In a certain river, there are a bunch of stepping stones arranged from one
side to the other. A very athletic person can cross the river by jumping on
these stepping stones, one at a time.
A stepping stone is big enough for only one person, and the gap between two
stepping stones is small enough that it is possible to jump between two
adjacent stepping stones.
You are an army commander trying to get a group of soldiers across this river
(using these stepping stones). Initially your n soldiers are placed on the
first n stepping stones. Your task is to get all of them onto the last n
stepping stones.
For example, here are the five possible ways to get a group of two soldiers
across a river with five stepping stones:
1) ##--- #-#-- -##-- -#-#- --##- --#-# ---##
2) ##--- #-#-- -##-- -#-#- -#--# --#-# ---##
3) ##--- #-#-- #--#- -#-#- --##- --#-# ---##
4) ##--- #-#-- #--#- -#-#- -#--# --#-# ---##
5) ##--- #-#-- #--#- #---# -#--# --#-# ---##
Let C(k,n) be the number of ways of which n soldiers can cross a river with k
stepping stones. In the example, C(5,2) = 5.
Find C(50,12) mod 987654321.
其实这站很多归类於程式题的好像都会被数学做法秒杀....
这题的话,当n=2 时应该就是等价於高中排列组合学的
"两候选人开票 A票数一路领先B的方法数"此类题目 是有公式解的
其实以前我就有想过要是不只两个人怎麽办....不过一直没有得到解答
也有请教ㄧ些学长 不过好像也没什麽想法@@
所以我猜这题没有数学做法(?)不过应该有递回式....但我想不太到@@@@?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.231.104.225