Problem 44787. What can you get for exactly amount of money(harder)

Inspired by "Problem 42996. what can you get for exactly amount of money" https://ww2.mathworks.cn/matlabcentral/cody/problems/42996-what-can-you-get-for-exactly-amount-of-money Problem 42996 is a good problem, but the test suit is too weak.

You go to store, where each product has price. Prices are in vector

v = [ 195 125 260 440 395 290] and you have amount of money s=570

Question is what can you buy, if you want to use whole amount of money

For this data answer is

res=[ 125 125 125 195]

The answer may not be unique, return any feasible answer. Do not cheat please.

In this hard version, 1 <= length(v) <= 50 1 <= s <= 10000000019 (1e10 + 19)

Solution Stats

40.0% Correct | 60.0% Incorrect
Last Solution submitted on Oct 29, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers12

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!