外星人的一天
地球上的一天是 24 小时。但地球上还有一些精力和勤奋度都远超一般人的大神级人物,他们的“一天”是以 48 小时为周期运转的,这种人被人们尊称为“外星人”。比如普通人的周一早 8:30 是外星人的周一早 4:15;普通人的周二早 9:21 是外星人的周一下午 4:40 —— 对外星人而言,一周的工作时间只有三天(即普通人的周一至周六),周日他们会蒙头大睡恢复体力,时间对他们是没有意义的。
在外星人眼里,地球人的时钟对他们而言实在是太不方便了。本题就请你为外星人们实现一款专用时钟。
输入格式:
输入在一行中给出一个不超过 10 的正整数 N,随后 N 行,每行给出一个地球人的时刻,格式为:Day hh:mm
,其中Day
是 [0,6] 区间内的整数,顺序代表周日至周六;hh
是 24 小时制的小时数,是 [0,23] 区间内的整数;mm
是分钟数,是 [0,59] 区间内的整数。
输出格式:
对输入的每一行地球人时刻,输出对应的外星人时间,格式与输入相同。其中Day
在 [0,3] 区间内,对应周日到周三;分钟数若不是整数,则向下取整。注意:由于周日的时间对外星人没有意义,所以直接输出地球人的时间即可。
输入样例:
3
1 08:30
2 09:21
0 21:07
输出样例:
1 04:15
1 16:40
0 21:07
/*******************************************************************************/
/* ___________ ___ ___ ___ */
/* /_______ /\ / /\ / /\ / /\ */
/* \ / / \ / / \ / / \ / / \ */
/* \____/ / / / / / / / / / / / */
/* / / / / /___/___/ / / / / / */
/* / / / / ________ / / / / / */
/* / / / / /\ / / / / / / */
/* / /___/____ / / \____/ / / / /___/___ */
/* /___________/\ /__/ / /__/ / /___________/\ */
/* \ \ \ \ \ / \ \ / \ \ \ */
/* \___________\/ \__\/ \__\/ \___________\/ */
/* */
/*******************************************************************************/
#include <stdio.h>
#include <iostream>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#define mem0(arr) memset(arr,0,sizeof(arr))
using namespace std;
int main()
{
int n;
int a, b, c;
cin >> n;
for (int i = 0; i < n; i++)
{
scanf("%d%d:%d", &a, &b, &c);
if (a == 0)
printf("%d %02d:%02d\n", a, b, c);
else
{
if (a%2==1)
{
c = ((b % 2) * 60 + c) / 2;
b = b / 2;
}
else
{
b = b + 24;
c = ((b % 2) * 60 + c) / 2;
b = b / 2;
}
printf("%d %02d:%02d\n", (a + 1) / 2, b, c);
}
}
}