How to solve this problem?

Revision en3, by 444iq, 2019-09-07 10:42:29

answer will be 65 for the 2nd test case?

input 3.

1 , 2 , 4 , 8. and b = 3

fill 1 litre on day 1 and 3 on day 2 , total cost = 7.

my greedy approach of taking as much as we can in a given range with minimum cost fails.

my idea for input 3, fill 3 on day 1, and 1 on day 4 but it gives a cost of 11 which is not optimal.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English 444iq 2019-09-07 10:42:29 196
en2 English 444iq 2019-09-07 10:41:04 221
en1 English 444iq 2019-09-07 10:39:46 98 Initial revision (published)