TopcoderArchive
Archive25 Sep 2001
TCI '01 Round 3

Clock

Problem statement, definition, constraints, and public examples.

Problem Statement

PROBLEM STATEMENT
Implement a class Clock, which contains a method getAngles.  getAngles takes a
String in the form "HH:MM:SS" representing a time of day.  getAngles returns an
int[] holding the angles that the hour hand, minute hand, and the seconds hand
make, clockwise, from 12:00:00 to the hand.  At 12:00:00 all hands are at 0
degrees. If the angle is not a whole number of degrees, simply truncate the
decimal part. 

DEFINITION
Class Name: Clock
Method Name: getAngles
Parameters: String
Returns: int[]
Method signature (be sure your method is public):  int[] getAngles(String time);

TopCoder will ensure the validity of the inputs.  Inputs are valid if all of
the following criteria are met:
- The input String is in the form "HH:MM:SS"
- HH is an integer between 01 and 12, inclusive, representing hours.
- MM is an integer between 00 and 59, inclusive, representing minutes.
- SS is an integer between 00 and 59, inclusive, representing seconds.

NOTES
-  The element located at index zero of the return int[] should represent the
angle that the hour hand made from 12:00:00 to the hour hand.
-  The element located at index one of the return int[] should represent the
angle that the minute hand made from 12:00:00 to the minute hand.
-  The element located at index two of the return int[] should represent the
angle that the seconds hand made from 12:00:00 to the seconds hand.
-  The seconds hand makes one full rotation every minute, the minute hand makes
one full rotation every hour, and the hour hand makes one full rotation every
twelve hours. 
-  Keep in mind that the hour and minute hands are continuously moving.  For
example, the number of degrees returned for the minute and hour hands at
01:07:00 will not be the same as the number of degrees returned for the minute
and hour hands at 01:08:00. 


EXAMPLES
"06:00:00" getAngles returns [180, 0, 0]
"08:30:00" getAngles returns [255, 180, 0]
"10:17:55" getAngles returns [308, 107, 330]


Definition

Class:
Clock
Method:
getAngles
Parameters:
String
Returns:
int[]
Method signature:
int[] getAngles(String 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