CD
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape minutes long. How to choose tracks from CD to get most out of tape space and have as short unused space as possible.
Assumptions:
number of tracks on the CD. does not exceed
no track is longer than minutes
length of each track is expressed as an integer number
is also integer ().
Program should find the set of tracks which fills the tape best and print it in the same sequence as the tracks are stored on the CD.
Input
Any number of lines. Each one contains value , (after space) number of tracks and durations of the tracks. For example from first line in sample data: , number of track , first track lasts for minute, second one minutes, next one minutes.
Output
String "sum:" and sum of duration times.