题目链接:7-7 12-24小时制
一. 题目
1. 题目
2. 输入输出格式
3. 输入输出样例
4. 限制
二、代码
1. 代码实现
#include <stdio.h>int main(void) {int hour, minute;char *str;if (scanf("%d:%d", &hour, &minute) != 2) {return -1;}if (hour < 12) {str = "AM";} else if (hour < 24) {str = "PM";if (hour != 12) {hour -= 12;}} else {hour = 0;str = "AM";}printf("%d:%d %s", hour, minute, str);return 0;
}