#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<memory.h>
using namespace std;
int main()
{
int t;
while (cin >> t)
{
while (t--)
{
getchar();
char st;
int d, h, m;
cin >> st >> d >> h >> m;
if (st == 'F')
{
m += d;
if (m >= 60)
{
h += m / 60;
m %= 60;
}
if (h >= 24)
h %= 24;
}
else if (st == 'B')
{
m -= d;
double mint = m;
while (m < 0)
{
h -= 1;
m += 60;
}
if (h < 0)
h += 24;
}
cout << h << " " << m << endl;
}
}
return 0;
}
Kattis-dst Daylight Saving Time【题解】
猜你喜欢
转载自blog.csdn.net/okimaru/article/details/88291334
今日推荐
周排行