Guest User

[insert creative algo chall name]

a guest
Jul 12th, 2020
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Find the total number of unique combinations for input values of x = 4 and n = 12
  2. There exists a set of values, r, with values binary increasing (2^0, 2^1, ... 2^(n-1))
  3. 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
  4. The x subsets should use all values in r exactly once.
  5.  
  6. Example Case:
  7. Input:
  8. x = 3
  9. n = 5
  10.  
  11. Given the input above we can create a set r that consists of the following n values
  12. [2^0, 2^1, 2^2, 2^3, 2^4]
  13. OR
  14. [1, 2, 4, 8, 16]
  15.  
  16. Each combination is formed via x subsets of the set [1, 2, 4, 8, 16]
  17. [16], [2,8], [1, 4]
  18. [1, 2, 4], [8], [16]
  19. [1, 4], [2, 8], [16]
  20. ...
  21.  
  22. This renders sets of size x that are the sums of the elements of each set
  23. 16, 10, 5
  24. 7, 8, 16
  25. 5, 10, 16
  26. ...
  27.  
  28. Note: combination 1 and combination 3 are the duplicates and should not be counted twice as they both consist of 5, 10, and 16
  29.  
  30. All possible unique combinations for x = 3 and n = 5:
  31. 3 8 20
  32. 4 8 19
  33. 1 12 18
  34. 4 9 18
  35. 5 8 18
  36. 2 12 17
  37. 4 10 17
  38. 6 8 17
  39. 1 14 16
  40. 2 13 16
  41. 3 12 16
  42. 4 11 16
  43. 5 10 16
  44. 6 9 16
  45. 7 8 16
  46. 1 2 28
  47. 1 4 26
  48. 2 4 25
  49. 1 6 24
  50. 2 5 24
  51. 3 4 24
  52. 1 8 22
  53. 2 8 21
  54. 1 10 20
  55. 2 9 20
  56.  
  57. Final Output:
  58. 25
  59. (There are 25 combinations generated above)
  60.  
  61. *IMPORTANT*
  62. 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