CCC '09 J3 - Good Times

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2009 Stage 1, Junior #3

A mobile cell service provider in Ottawa broadcasts an automated time standard to its mobile users that reflects the local time at the user's actual location in Canada. This ensures that text messages have a valid local time attached to them.

For example, when it is 1420 in Ottawa on Tuesday February 24, 2009 (specified using military, 24 hour format), the times across the country are shown in the table below:

Pacific Time Mountain Time Central Time Eastern Time Atlantic Time Newfoundland Time
Victoria, BC
1120 PST
Edmonton, AB
1220 MST
Winnipeg, MB
1320 CST
Toronto, ON
1420 EST
Halifax, NS
1520 AST
St. John's, NL
1550 Newfoundland ST

Write a program that accepts the time in Ottawa in 24 hour format and outputs the local time in each of the cities listed above including Ottawa. You should assume that the input time will be valid (i.e., an integer between 0 and 2359 with the last two digits being between 00 and 59).

You should note that 2359 is one minute to midnight, midnight is 0, and 13 minutes after midnight is 13. You do not need to print leading zeros, and input will not contain any extra leading zeros.

Sample Input


Sample Output

1300 in Ottawa
1000 in Victoria
1100 in Edmonton
1200 in Winnipeg
1300 in Toronto
1400 in Halifax
1430 in St. John's


  • 0
    kn2311  commented on Jan. 12, 2024, 1:24 a.m.

    well, if you are not good at coding, you can just use if and if else to solve it, because we are just doing the easy math to find out the time

    • 2
      Peter2023  commented on Jan. 20, 2024, 5:01 a.m.

      Facts brotha

  • -2
    AndrewC  commented on Dec. 7, 2020, 3:33 a.m.

    Hello, does anyone know why my code is wrong for test case 5?

    • 6
      goomba  commented on Dec. 7, 2020, 1:53 p.m. edited

      Try the test case '45', and pay attention to St. John's.

      • 0
        AndrewC  commented on Dec. 8, 2020, 3:50 a.m.

        Thank you so much!!

  • 4
    HARRIBO  commented on Aug. 24, 2019, 9:16 p.m.

    Anyone know why the word "Winnipeg," cuts off to "Winnipe"

    • 9
      AlanL  commented on Aug. 24, 2019, 11:43 p.m. edited

      Output is clipped, so you don't see all of your program's output. Your program is probably outputting "Winnipeg", but you only see "Winnipe". Please join the dmoj discord as it will probably be faster for you to get answers to your questions on there.

  • 2
    Arihan10  commented on Jan. 25, 2019, 2:16 p.m. edited

    Does anyone know why I am getting WA on this?


    EDIT: Nevermind I got it now.

    • 3
      magicalsoup  commented on Jan. 25, 2019, 5:40 p.m.

      you might want to look at the NewFoundLand Time a bit more carefully, see if it follows your logic, this time is special because it doesn't go by an multiple of hours, instead it goes by a specific amount of minutes, which might have broke your logic and caused you to print some absurd time like 14:70

      • 4
        Arihan10  commented on Jan. 25, 2019, 5:47 p.m. edit 2

        Nevermind I think I got it. It's 24:00 standard (I assumed 12:00).

        • -5
          QiQi  commented on Nov. 25, 2021, 11:38 p.m. edit 3

          This comment is hidden due to too much negative feedback. Show it anyway.