TopcoderArchiveVisit Topcoder
SRM16 Jul 2001
SRM 14

Hands

Problem statement, definition, constraints, and public examples.

Problem Statement

Class name: Hands
Method name: overlap
Parameters: int
Returns: String

Implement a class Hands, which contains a method overlap.  The method takes an
int representing an hour and returns a String representing the closest time
(hour, minutes, and seconds) after or including the start of that hour that the
hour and minute hands overlap.

The time should be returned as a String, in the format hh:mm:ss, where hh is
the hour (from 01 to 12), mm is the minute (from 00 to 59), and ss is the
number of seconds (from 00 to 59).  The fractional seconds in the result should
be discarded (i.e., round down or truncate).

The method signature is:
public String overlap(int hour);

hour is between 1 and 12, inclusive.

Examples:
- If hour is 12, the hands are already overlapping at "12:00:00"
- If hour is 3, the hands will overlap at "03:16:21"
- If hour is 9, the hands will overlap at "09:49:05"

Definition

Class:
Hands
Method:
overlap
Parameters:
int
Returns:
String
Method signature:
String overlap(int param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems