Happy New Year!

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

A popular meme that's been going around on the internet goes like this:

If you start <some something> at <some time> on <some day>, then you'll be able to <some other thing> as the clock strikes midnight. Kick off 2018 the right way.

Given that this certain "some something" takes h hours, m minutes, and s seconds, find this certain "some time".

Constraints

0 \le h,m,s \le 10^9

Input Specification

Three space-separated integers, h, m, and s, respectively.

Output Specification

The time of day when you should start the task, in the form hours:minutes:seconds. Note that this time should follow the 12-hour clock convention, with all leading zeroes, including the hours. You should not print out am or pm though.

EDIT: If the time is 12:??:??, you should output 00:??:??.

Sample Input 1

0 34 5

Sample Output 1

11:25:55

Sample Input 2

0 120 0

Sample Output 2

10:00:00

Sample Input 3

13 0 0

Sample Output 3

11:00:00

Comments


  • -1
    rudi  commented on Dec. 9, 2019, 1:39 p.m.

    Can someone help me work through why some tests are failing?

    I'm giving fixed output formatting so it will always display in ??:??:?? format. I'm guessing that for some reason I'm failing on the tests where hours are > 12 but I don't actually know why, when I try to supply values the expected output is returned. I have a hardcoded change so that if hours == 00, hours = 12 as per the edit.


  • 3
    IanHu  commented on Oct. 14, 2019, 9:40 p.m. edited

    Somebody helps we what's wrong with my code QAQ


    • 1
      hxxr  commented on Oct. 14, 2019, 10:33 p.m.

      When the time needed to perform the task is converted to seconds the value may exceed 2^{31}-1 so it cannot be stored as an int.


      • 0
        IanHu  commented on Oct. 14, 2019, 10:51 p.m.

        Ohhhh, Thank You!