aya1909's blog

By aya1909, history, 4 months ago, In English

You are working in Samara, Russia for a few days. Each day has a new pay per unit of work and a new cost per unit of food. Working 1 unit costs 1 unit of energy, and eating 1 unit of food adds 1 unit of energy. Here are some specifications of your employment:

You arrive with no money, but with energy. You can never have more energy than you arrive with, and it can never be negative. You can do any amount of work every day (possibly not do any work at all), limited only by your energy. You cannot work when your energy is zero. You can eat any amount of food every day (possibly not have any food at all), limited by the money you have. You cannot eat when the money you have is zero. You can eat food at the end of the day, and cannot return to work after eating. You can return to work the next day. Your true goal is to return home with as much money as possible. Compute the maximum amount of money you can take home.

Input: N = 3, Earning=[1, 2, 4], Cost[]=[1, 3, 6], E = 5 Output: 20

  • Vote: I like it
  • +2
  • Vote: I do not like it