簡體   English   中英

安排中涉及斐波那契的問題

[英]problem involving Fibonacci in arrangement

問題陳述如下:有N個人站成一排。 第 i 個人站在第 i 個 position 中。 我們可以通過多少種方式安排人員,使每個人要么在他們自己的 position 中,要么在他們相鄰的 position 中?

我認為答案遵循 Finonacci 模式。

like if N = 1, 
The answer is 1. If N = 2, the answer is 2.
If N = 3, then the answer is 3, if N = 4, then the answer is 5, and so on.

This is via observation. Can you provide concrete proof why this is always true?

我的嘗試:

If the (N-1)th number is in its own position, then we can't 
do any change and the answer is just ans[N-1]. Otherwise, 
swap Nth and (N-1)th position and it will give arrangements ans[N-2]
so final ans[N] = ans[N-1]+ans[N-2] 

通過歸納:

正如您所展示的,您的陳述對於小值是正確的。 假設確實,對於每個正數 integer 直到 n 都有符合您標准的 Fib(n) 排列。 然后,我們添加一個人。

我們的新人可以占據兩個位置:第 n 個和第 (n+1) 個。

在后一種情況下,我們計算了排列前 n 個項目的 Fib(n) 種方式。 前一種情況必然是第(n+1)個和第n個交換,並且有Fib(n-1)種方式安排前n-1人。

由於 Fib(n-1) + Fib(n) = Fib(n+1),我們已經通過歸納證明了你的定理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM