#C5583. 24-Hour to 12-Hour Time Conversion
24-Hour to 12-Hour Time Conversion
24-Hour to 12-Hour Time Conversion
You are given two integers representing the hour and minute in a 24-hour clock format. Your task is to convert this time to the 12-hour format appended with the appropriate AM/PM suffix.
Let \( h \) and \( m \) be the hour and minute respectively, where \(0 \leq h < 24\) and \(0 \leq m < 60\). The conversion is as follows:
- If \( h = 0 \) or \( h = 12 \), it corresponds to 12.
- If \( h > 12 \), then the 12-hour format is \( h - 12 \).
- For \( 0 < h < 12 \), the time remains the same.
The period is "AM" for times before noon (\( h < 12 \)) and "PM" for times from noon onward (\( h \geq 12 \)). The result should be formatted with two digits for both the hour and the minute, for example: "01:30 PM".
inputFormat
The input is provided via stdin and consists of a single line containing two space-separated integers:
- hour: an integer \( h \) such that \(0 \leq h < 24\).
- minute: an integer \( m \) such that \(0 \leq m < 60\).
outputFormat
Output the given time in 12-hour format with the AM/PM indicator to stdout. The output should be a single line containing the time in the format "HH:MM AM" or "HH:MM PM" (with leading zeros if needed).
## sample13 30
01:30 PM