시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 256 MB | 54 | 33 | 30 | 58.824% |
Ali works in a small software company in which the waging method is based on the useful working hours of people (not just their presence). This information is provided by the employees themselves based on a mutual trust. Ali is a rigorous person on such issues. So, during the day, he records all the information needed to calculate the total useful working hours of that day. During months of his work, he has evolved a special format for his recordings. The recording consists of several terms. Each term is a positive or negative time (with separate hours and minutes parts), e.g. -8:30 or +09:20. Ali found that he can express all he needs to record using such terms. For example:
Obviously, the order of the terms does not affect the final result. As a programmer, Ali knows summing up the terms is a boring and error-prone task – something which could be done by computers. Your task is to write a program that does all these summations for Ali. But, entering the recorded terms in the above format was still annoying for Ali. So he tweaked the format a little bit in order to speed up the data entry process:
There are several test cases in the input. Each test case, consists of several lines (at most 1000 lines) each containing a single term. Test cases are separated with a line containing \$\$\$, and a line containing ### follows the last test case.
For each test case, output a line containing the sum of the terms. It is guaranteed that the answer is positive. The answer should be written in the H:MM format. So, the minutes part (MM) is always a two digit number in range [00..59], and the hours part (H) is a non-negative integer with no leading zeros.
-11.45 -:5 -1:10 -.30 -.5 +21.55 $$$ -8. -1. -:3 +12. +.10 ###
8:20 3:07
ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2014 F번