推 mixxim :推 這方法數一副該用對應方式來構造 一時沒想到 @@ 03/15 11:13
※ 引述《mixxim (米克斯)》之銘言:
: ※ 引述《mvpnashmvp (林桑)》之銘言:
: : How many arrangements of the integer 1,2,...,n are there such that each
: : integer(except the first integer) differs by 1 from some integer to
: : the left of it in the arrangement?
: n=1: 1
: n=2: 12 21
: n=3: 123 213 231 321
: n=4: 1234 2134 2314 2341 3214 3241 3421 4321
: n=5: 12345 ... 等16個
: 經過觀察看起來真的是 2^(n-1),試著歸納看看
可以直接證。以下以 n=9 為例,作為一般性證明的提示:
考慮字串「大小小大大大小大」,此字串對應到 4-53267819.
觀察重點:(a) 第一位數字如何決定?
(b) 「小」數排列的規則為何?「大」數排列的規則為何?
這些提示應該就夠了。
--
廢話這麼多,還不就是為了撈 P 幣 :q
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.122.140.53