The Fibonacci numbers are defined as follows.
- F[1]=1
- F[2]=1
- F[N]=F[N−1]+F[N−2] (N≥3)
You are given a set S of N numbers and an integer K. For every subset s of S whose size is K, take the sum of its elements sum(s), and add up F[sum(s)] over all such subsets. Write a program that computes that total.
For example, take S={1,2,3,4,5} and K=2. The subsets of size 2 are {1,2}, {1,3}, {1,4}, {1,5}, {2,3}, {2,4}, {2,5}, {3,4}, {3,5}, {4,5}. Their sums are 3, 4, 5, 6, 5, 6, 7, 7, 8, 9 in that order, so the total is F[3]+F[4]+F[5]+F[6]+F[5]+F[6]+F[7]+F[7]+F[8]+F[9]=112.