2
我們可以用2個固定值填充n個地方以及2個選定地點之間的值的休息地方的方法數量是多少,這樣我們就不會有重複?用固定值填充n個地方的方法
例如:n = 4時,固定值1和3
case 1 : fix 1 on position 1 and 3 on position 2
1 3 1 1
1 3 1 2
1 3 2 1
1 3 2 2
1 3 1 3
1 3 3 1
1 3 3 3
1 3 2 3
1 3 3 2
case 2 : fix 1 on position 1 and 3 on position 3
1 1 3 1
1 1 3 2
1 2 3 1
1 2 3 2
1 3 3 2
1 2 3 3
1 3 3 1
1 1 3 3
1 3 3 3
now in case 1 and 2 : 1 3 3 3 and 1 3 3 1 and 1 3 3 2 are repeating
case 3 : ....similarly other cases follow
我所做至今是:nC2 * POWER((max-min+1) , n-2) - duplicates
但不能減去重複。
請說明您有多少個案件正在考慮,以及它們是如何定義的?也許你必須考慮2個固定值在任何2個位置的所有可能的定位? ..或者使用的案例和職位的數量是作爲單獨的數據給出的? –