What can you get for exactly amount of money(harder) - MATLAB Cody - MATLAB Central

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

Difficulty:Rate

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

41.46% Correct | 58.54% 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 Solvers13

Community Treasure Hunt

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

Start Hunting!
Go to top of page