close

Вход

Забыли?

вход по аккаунту

код для вставкиСкачать
ACM Contest Problems Arhive
778
University of Valladolid (SPAIN)
Reording a tape
The market oers several types of assette tapes, with standard time durations. You have some of these
types at home, and you want to reord all songs from a given list. The songs you hope to reord have
their time durations expressed, as usual, in minutes and seonds. Given the list of songs, nd the list
per side in whih they have to be reorded in order to use the shortest possible available assette for
reording them.
Input
The rst line in the input le informs the assette durations available; eah of the following lines ontain
the duration of one song. The input le ontains several instanes, that follow this same speiation,
whih nish with a line ontaining only a % (perentage symbol).
Output
The rst line should ontain the duration of the assette. Next, \Side A" should be printed followed
by lines with the song durations for this side. \Side B" follows in the same manner. The output le
should have a % (perentage symbol) printed after the output of eah of the several input instanes.
Sample Input
56 90 120
20m 44s
4m 36s
7m 18s
13m 8s
9m 6s
8m 12s
%
30 45
3m 11s
4m 45s
13m 45s
6m 8s
%
ACM Contest Problems Arhive
Sample Output
90
Side A
20m 44s
4m 36s
7m 8s
Side B
13m 8s
9m 6s
8m 12s
%
30
Side A
3m 11s
4m 45s
6m 8s
Side B
13m 45s
%
Observations:
No pair of songs have the same duration.
University of Valladolid (SPAIN)
1/--страниц
Пожаловаться на содержимое документа