Sum of combinations - MATLAB Cody - MATLAB Central

Problem 44456. Sum of combinations

Difficulty:Rate

Input: X = 40, Y = [40 20 10 4]

Output: Z = [1 0 0 0; 0 2 0 0; 0 1 2 0; 0 1 1 3; 0 1 0 5; 0 0 4 0; 0 0 3 3; 0 0 2 5; 0 0 1 8; 0 0 0 10]

Description:

  • Z(1,:)*Y' >=40; (40*1+0+0+0)=40
  • Z(4,:)*Y' >=40; (0+20*1+10*1+4*3)>40 (but minimum), and so on...
  • Z should not contain any fraction.
  • Z should contain all possible combinations.
  • Input Y is always sorted

Solution Stats

22.64% Correct | 77.36% Incorrect
Last Solution submitted on Dec 06, 2024

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
2
4
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Group

Physics Image
Physics
  • 18 Problems
  • 13 Finishers

Problem Recent Solvers17

Problem Tags

sum

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page