New Year's '18 P1 - 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


  • 2
    IanHu  commented on Oct. 15, 2019, 1:40 a.m. edited

    Somebody helps we what's wrong with my code QAQ


    • 1
      hxxr  commented on Oct. 15, 2019, 2:33 a.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.


      • 1
        IanHu  commented on Oct. 15, 2019, 2:51 a.m.

        Ohhhh, Thank You!