Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Find the total number of unique combinations for input values of x = 4 and n = 12
- There exists a set of values, r, with values binary increasing (2^0, 2^1, ... 2^(n-1))
- A combination is a set of x values where each value is generated by creating x subsets of r with all values within a subset being summed
- The x subsets should use all values in r exactly once.
- Example Case:
- Input:
- x = 3
- n = 5
- Given the input above we can create a set r that consists of the following n values
- [2^0, 2^1, 2^2, 2^3, 2^4]
- OR
- [1, 2, 4, 8, 16]
- Each combination is formed via x subsets of the set [1, 2, 4, 8, 16]
- [16], [2,8], [1, 4]
- [1, 2, 4], [8], [16]
- [1, 4], [2, 8], [16]
- ...
- This renders sets of size x that are the sums of the elements of each set
- 16, 10, 5
- 7, 8, 16
- 5, 10, 16
- ...
- Note: combination 1 and combination 3 are the duplicates and should not be counted twice as they both consist of 5, 10, and 16
- All possible unique combinations for x = 3 and n = 5:
- 3 8 20
- 4 8 19
- 1 12 18
- 4 9 18
- 5 8 18
- 2 12 17
- 4 10 17
- 6 8 17
- 1 14 16
- 2 13 16
- 3 12 16
- 4 11 16
- 5 10 16
- 6 9 16
- 7 8 16
- 1 2 28
- 1 4 26
- 2 4 25
- 1 6 24
- 2 5 24
- 3 4 24
- 1 8 22
- 2 8 21
- 1 10 20
- 2 9 20
- Final Output:
- 25
- (There are 25 combinations generated above)
- *IMPORTANT*
- The answer should be formatted as rgbctf{[output value here]} with your output value replacing [output value here]
Add Comment
Please, Sign In to add comment