Connection Status:
Competition Arena > MirroredClock
SRM 363 · 2007-08-11 · by mateuszek · Simple Math, String Parsing
Class Name: MirroredClock
Return Type: String
Method Name: whatTimeIsIt
Arg Types: (string)
Problem Statement

Problem Statement

You are sitting in front of a mirror and looking at the image of a clock located behind you. You want to know what time it is. The clock is a traditional clock with a 12-hour board (without numbers written on it), a minute and an hour hand (the hour hand is shorter, so that you can distuniguish them). You are given a String time denoting the time as it is seen in the mirror. The time will be formatted as "HH:MM" (quotes for clarity), where HH is the two digit hour and MM is the two digit minute. The hour will be between 00 and 11, inclusive, where 00 represents 12 o' clock. Return a String in the same format denoting the actual time. See examples for further clarification.

Constraints

  • time will be formatted as "HH:MM" (quotes for clarity), where HH is a two digit integer between 00 and 11, inclusive, and MM is a two digit integer between 00 and 59, inclusive.
Examples
0)
"10:00"
Returns: "02:00"
1)
"01:15"
Returns: "10:45"
2)
"03:40"
Returns: "08:20"
3)
"00:00"
Returns: "00:00"

Although it doesn't happen often, sometimes we can see the actual time right in the mirror.

4)
"11:53"
Returns: "00:07"

Submissions are judged against all 59 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class MirroredClock with a public method string whatTimeIsIt(string time) · 59 test cases · 2 s / 256 MB per case

Submitting as anonymous