Editorial for COCI '06 Contest 5 #2 Natrij


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

For both given times, we'll calculate the number of seconds elapsed since the current day started. For the starting time, that number is H \cdot 60 \cdot 60 + M \cdot 60 + S. For the ending time, we use the same expression, except if the ending time is earlier than the starting time. In that case, the ending time is actually the next day, so we need to add 24 \cdot 60 \cdot 60 = 86\,400 seconds.

Subtracting the two numbers we get the number of seconds between the two times. This needs to be converted into hours, minutes and seconds.

Also note the case when the given times are equal. The task description says that 24 hours should be output, not 0.


Comments

There are no comments at the moment.