Блог пользователя _1600_

Автор _1600_, история, 4 года назад, По-английски

Hi guys, hope you are doing well. I have a hard problem that I cannot solve, and I want to ask you guys for the solution. The statement is:

You are given $$$n$$$ candies, the $$$i$$$-th candy has size $$$c_i$$$. You are planning to buy exactly $$$m$$$ jars of equal sizes. What is the minimum jar size you can buy so that it is possible to assign each candy to exactly one jar without exceeding the jar's size, and every candy should be used. Point out a way to do so $$$(1 <= m <= n, m <= 5, n <= 500)$$$

I think there is either a greedy or DP approach, but I haven't figure it out yet, since it is really hard for my level. Sorry for my bad English. Thank you a lot, I really appreciate your help !

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится