Cody

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

Created by li haitao in Community

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

22.22% Correct | 77.78% Incorrect
Last solution submitted on Nov 21, 2018

Problem Comments