版权声明:沃斯里德小浩浩啊 https://blog.csdn.net/Healer66/article/details/86549992
题意:
给出UTC+8的小时a和分钟b,求 "UTC+X'', "UTC-X'', "UTC+X.Y'', or "UTC-X.Y''的日期。
思路:
转成分钟计算
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
int t, h, m;
char s[20];
cin>>t;
while(t--)
{
scanf("%d%d%s", &h, &m, s);
h = h*60+m;
int sg = s[3]=='+'?1:-1;//符号
double x;
sscanf(s+4, "%lf", &x);
x = (int)(x*10); //读浮点数会有误差
int cha = x*6*sg-8*60;//差值
h = (h+cha+24*60;)%(24*60);
printf("%02d:%02d\n", h/60, h%60);
}
return 0;
}