DWITE, February 2013, Problem 1
Travelling can be very tiresome. One of the most annoying aspects of travelling is adjusting your watch to the appropriate time, after reaching the destination. Being an avid traveller yourself, you decide to write a program to help you determine the local time at the time of arrival.
The input will contain 5 test cases. Each test case consists of one line containing a timestamp (in a 24-hour clock, e.g. 13:59:05
) and a space separated pair of numbers . is the number of hours the journey takes, and is the number of hours the destination timezone is ahead of the origin timezone (negative time ahead is interpreted as "behind"; similarly, negative travel time is calculating the time before the journey started).
The output will contain 5 lines of output. The 24-hour timestamp of the expected local time at the destination.
Notes on sample data: The first case starts out at AM. After hours it is now PM; there is no timezone adjustment. The second case is similar, but the destination timezone is hours ahead, so it's PM. The third case is PM... of the previous day. Case 4 starts at midnight, and you are not going anywhere.
Sample Input (first 4 cases shown)
03:01:01 10 0
03:02:02 10 5
03:03:03 10 -23
00:00:00 0 0
Sample Output (first 4 cases shown)
13:01:01
18:02:02
14:03:03
00:00:00
Problem Resource: DWITE
Comments