subject
Engineering, 18.11.2019 22:31 amandamelton1

College students get a lot of free food at various events. suppose you have a schedule of the next n days marked with those days when you get a free dinner, and those days on which you must acquire dinner on your own. on any given day you can buy dinner at the cafeteria for $6. alternatively, you can purchase one week’s groceries for $20, which will provide dinner for each day that week. however, because you don’t have a fridge, the groceries will go bad after seven days (including the day of purchase) and any leftovers must be discarded. due to your very busy schedule, these are your only three options for dinner each night.
write a dynamic programming algorithm to determine, given the schedule of free meals, the minimum amount of money you must spend to make sure you have dinner each night and to print the dates on which you should purchase groceries. explain why your algorithm is correct and has running time polynomial in n, the number of days on the schedule.
hint: start by writing a recursive procedure to determine how you should eat dinner on the last night.
language: c++

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
The filament of an incandescent lamp has a temperature of 2000k. calculate the fraction of radiation emitted in the visible light band if the filament is approximated as blackbody
Answers: 2
question
Engineering, 04.07.2019 18:10
Which of the following ziegler nichols tuning methods the response of the controller to a step input should exhibit an s-shaped curve? a)-open loop mode b)-closed loop mode c)-both modes (open & closed) d)-none of the modes (open & closed)
Answers: 3
question
Engineering, 04.07.2019 19:10
The air in an automobile tire with a volume of 0.015 m3 is at 32°c and 140 kpa gage. determine the amount of air that must be added to raise the pressure to the recommended value of 206 kpa gage. assume the atmospheric pressure to be 128 kpa and the temperature and the volume to remain constant.[r-0.287 kj/kgk]
Answers: 3
question
Engineering, 04.07.2019 19:20
Acircular pipe of 30mm outside diameter is placed in an airstream at 30 c and latm pressure. the air moves in cross flow over the pipe at 20 m/s, while the outer surface of the pipe is maintained at 110 c. what is the drag force exerted on the pipe per unit length? what is the rate of heat transfer from the pipe per unit length?
Answers: 1
You know the right answer?
College students get a lot of free food at various events. suppose you have a schedule of the next n...
Questions
question
French, 12.07.2019 18:00
Questions on the website: 13722362