311210: CF1950C. Clock Conversion

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:4 Solved:0

Description

C. Clock Conversiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Given the time in 24-hour format, output the equivalent time in 12-hour format.

  • 24-hour format divides the day into 24 hours from $00$ to $23$, each of which has 60 minutes from $00$ to $59$.
  • 12-hour format divides the day into two halves: the first half is $\mathrm{AM}$, and the second half is $\mathrm{PM}$. In each half, the hours are numbered in the order $12, 01, 02, 03, \dots, 11$. Each hour has 60 minutes numbered from $00$ to $59$.
Input

The first line contains a single integer $t$ ($1 \leq t \leq 1440$) — the number of test cases.

The only line of each test case contains a string $s$ of length $5$ with format hh:mm representing a valid time in the 24-hour format. hh represents the hour from $00$ to $23$, and mm represents the minute from $00$ to $59$.

The input will always be a valid time in 24-hour format.

Output

For each test case, output two strings separated by a space ("hh:mm AM" or "hh:mm PM"), which are the 12-hour equivalent to the time provided in the test case (without quotes).

You should output the time exactly as indicated; in particular, you should not remove leading zeroes.

ExampleInput
11
09:41
18:06
12:14
00:59
00:00
14:34
01:01
19:07
11:59
12:00
21:37
Output
09:41 AM
06:06 PM
12:14 PM
12:59 AM
12:00 AM
02:34 PM
01:01 AM
07:07 PM
11:59 AM
12:00 PM
09:37 PM

Output

题目大意:
给定24小时制的时间,输出其对应的12小时制时间。

输入数据格式:
第一行包含一个整数t(1≤t≤1440)——测试用例的数量。
每个测试用例仅包含一行,格式为"hh:mm"的字符串s,表示一个有效的24小时制时间。其中"hh"表示从00到23的小时,"mm"表示从00到59的分钟。
输入将始终是有效的24小时制时间。

输出数据格式:
对于每个测试用例,输出两个由空格分隔的字符串("hh:mm AM"或"hh:mm PM"),它们是测试用例中提供的12小时制时间的等价值(不带引号)。
你应该按指示精确输出时间;特别是,你不应该去除前导零。

示例:
输入:
```
11
09:41
18:06
12:14
00:59
00:00
14:34
01:01
19:07
11:59
12:00
21:37
```
输出:
```
09:41 AM
06:06 PM
12:14 PM
12:59 AM
12:00 AM
02:34 PM
01:01 AM
07:07 PM
11:59 AM
12:00 PM
09:37 PM
```题目大意: 给定24小时制的时间,输出其对应的12小时制时间。 输入数据格式: 第一行包含一个整数t(1≤t≤1440)——测试用例的数量。 每个测试用例仅包含一行,格式为"hh:mm"的字符串s,表示一个有效的24小时制时间。其中"hh"表示从00到23的小时,"mm"表示从00到59的分钟。 输入将始终是有效的24小时制时间。 输出数据格式: 对于每个测试用例,输出两个由空格分隔的字符串("hh:mm AM"或"hh:mm PM"),它们是测试用例中提供的12小时制时间的等价值(不带引号)。 你应该按指示精确输出时间;特别是,你不应该去除前导零。 示例: 输入: ``` 11 09:41 18:06 12:14 00:59 00:00 14:34 01:01 19:07 11:59 12:00 21:37 ``` 输出: ``` 09:41 AM 06:06 PM 12:14 PM 12:59 AM 12:00 AM 02:34 PM 01:01 AM 07:07 PM 11:59 AM 12:00 PM 09:37 PM ```

加入题单

算法标签: