Good Times
Time limit1sMemory limit128 MB
Given the time in Ottawa as hour*100+minute, print the local time in seven Canadian cities using fixed offsets, wrapping across midnight.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
A mobile phone provider in Ottawa broadcasts an automatic time signal to its subscribers that shows the correct local time wherever they are in Canada, so that every text message carries a valid local timestamp.
Canada spans six time zones. For example, when it is 1420 in Ottawa (Eastern Time), the local time in a representative city of each zone is as follows.
Ottawa is on Eastern Time. Relative to Ottawa the offsets are Victoria -3h, Edmonton -2h, Winnipeg -1h, Toronto 0, Halifax +1h, and St. John's +1h30m.
Given the current time in Ottawa in 24-hour format, output the corresponding local time in Ottawa, Victoria, Edmonton, Winnipeg, Toronto, Halifax, and St. John's.
Input
A single integer, the current time in Ottawa in 24-hour form. Midnight is 0, one minute past midnight is 1, 13 minutes past midnight is 13, and one minute before midnight is 2359. Formally the value is hour * 100 + minute with 0 <= hour <= 23 and 0 <= minute <= 59. The input contains no extra leading zeros.
Output
Print seven lines, one per city, in this order: Ottawa, Victoria, Edmonton, Winnipeg, Toronto, Halifax, St. John's. Each line has the form <time> in <City>, where the word in is printed literally and <time> is that city's local time written the same way as the input (hour * 100 + minute, with no leading zeros). The city names are printed in English exactly as Ottawa, Victoria, Edmonton, Winnipeg, Toronto, Halifax, St. John's. For example, midnight prints as 0 and 0:59 prints as 59.