Algorithm of 12608 - Garbage Collection

Problem Description Link
Algorithm
This is a simple problem this problem you can solve easily . To solve this problem you must remember 3 conditions.
Garbage truck is collecting garbage on its route starting at the dump and collecting garbage from pick up points in order (closest first). Garbage truck returns to the dump and empties its contents if it either
  1. is full or
  2. cannot load the garbage at the current point because it will put the load over the weight limit (the truck driver has no way of knowing the weight of the garbage at a particular pick up point until the truck reaches that point) or
  3. there are no more pick up points left

12608 - Garbage Collection

Problem Descriptin
source:https://uva.onlinejudge.org/external/126/12608.html



Garbage truck is collecting garbage on its route starting at the dump and collecting garbage from pick up points in order (closest first). Garbage truck returns to the dump and empties its contents if it either 
  1. is full or 
  2.  cannnot load the garbage at the current point because it will put the load over the weight limit (the truck driver has no way of knowing the weight of the garbage at a particular pick up point until the truck reaches that point) or 
  3. there are no more pick up points left