Chiaki often participates in international competitive programming contests. The time zone becomes a big problem. 

Given a time in Beijing time (UTC +8), Chiaki would like to know the time in another time zone ss.

Input

There are multiple test cases. The first line of input contains an integer TT (1≤T≤1061≤T≤106), indicating the number of test cases. For each test case: 

The first line contains two integers aa, bb (0≤a≤23,0≤b≤590≤a≤23,0≤b≤59) and a string ss in the format of "UTC+X'', "UTC-X'', "UTC+X.Y'', or "UTC-X.Y'' (0≤X,X.Y≤14,0≤Y≤90≤X,X.Y≤14,0≤Y≤9).

Output

For each test, output the time in the format of hh:mmhh:mm (24-hour clock).

Sample Input

3
11 11 UTC+8
11 12 UTC+9
11 23 UTC+0

Sample Output

11:11
12:12
03:23

题解:就是时区时间的转换,用sscanf(s+4."%lf",&d);将小数还原到数字d;

算出0时区的时间,再转化8时区即可;

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL inf=0x3f3f3f3f3f3f3f3fLL;
const int INF=0x3f3f3f3f;
int T,a,b;
char s1[10];
int main()
{ scanf("%d",&T);
while(T--)
{
scanf("%d%d",&a,&b);
int sum=a*60+b;
scanf("%s",s1);
double x;
int num= s1[3]=='+'? 1:-1;
sscanf(s1+4,"%lf",&x);
int cx=(int)(10*x);
sum=sum+cx*num*6-8*60;
int h=sum%(24*60);
if(h<0) h+=24*60;
printf("%02d:%02d\n",h/60,h%60); } return 0;
}

最新文章

  1. HTML5 Page Visibility
  2. Spark2.0自定义累加器
  3. vim中大小写转换
  4. cocos2dx 帧动画的两种创建方式
  5. C# 程序性能提升篇-1、装箱和拆箱,枚举的ToString浅析
  6. 7 Types of Regression Techniques you should know!
  7. 通过weka.jar包来进行数据预处理
  8. SerialPort
  9. log4net结构
  10. PHP图像处理:3D图纸、缩放、回转、剪下、水印(三)
  11. 探秘IntelliJ IDEA v13的应用服务器
  12. Ubuntu 定时任务中的环境变量设置
  13. Excel大写和小写转换函数
  14. autocomplete初步使用
  15. 内嵌圆角CSS实现
  16. Jenkins版本升级
  17. freemarker 设置中文
  18. spring配置redis注解缓存
  19. Eclipse配置方法注释模板
  20. ajax思维导图

热门文章

  1. dubbo中出现can not be invoked any more
  2. Ubuntu 16.04.4 安装openjdk各种问题
  3. java编程思想第四版第三章要点总结
  4. pat 1120 Friend Numbers(20 分)
  5. nyoj 100-1的个数 (因为只统计1的个数,连栈都不需要了)
  6. 【01】主函数main
  7. CCNA 之 七 路由协议 三 OSPF
  8. 痞子衡嵌入式:恩智浦i.MX RTxxx系列MCU启动那些事(3)- Serial ISP模式(blhost)
  9. #在windows上使用ngix重定向目录访问远程服务器文件详细实例
  10. selenium处理iframe和动作链