Cody

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

26.32% Correct | 73.68% Incorrect
Last Solution submitted on Oct 23, 2019

Problem Comments