Problem Description

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 s.
 

Input

There are multiple test cases. The first line of input contains an integer T (1≤T≤106), indicating the number of test cases. For each test case:
The first line contains two integers a, b (0≤a≤23,0≤b≤59) and a string s in the format of "UTC+X'', "UTC-X'', "UTC+X.Y'', or "UTC-X.Y'' (0≤X,X.Y≤14,0≤Y≤9).
 

Output

For each test, output the time in the format of hh: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
 
【题意】
给出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[];
cin>>t;
while(t--)
{
scanf("%d%d%s", &h, &m, s);
h = h*+m;
int op = s[]=='+'?:-;
double x;
sscanf(s+, "%lf", &x);
x = (int)(x*+0.005); //读浮点数会有误差
int cha = x**op-*;
h = (h+cha)%(*);
if(h < ) h += *;
printf("%02d:%02d\n", h/, h%);
}
return ;
}

【2018多校第一场】hdu6308-Time Zone(日期)的更多相关文章

  1. Time Zone 【模拟时区转换】(HDU暑假2018多校第一场)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6308 Time Zone Time Limit: 2000/1000 MS (Java/Others)  ...

  2. HDU6308(2018多校第一场)

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6308 将时间化简为分钟计算,同时不要用浮点数计算,精度会出现问题: 如果采用精度,最好加 ...

  3. HDU6300(2018多校第一场)

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6300 排个序就好了 #include<iostream> #include& ...

  4. HDU6301(2018多校第一场)

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6301 队友AC的,没怎么看 #include<iostream> #incl ...

  5. HDU6299(2018多校第一场)

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6299 两个字符串的排序可以分成四种情况: (1)str1左少右多 vs str2 左多右 ...

  6. HDU6298(2018多校第一场)

    Bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6298 打表找规律: #include<bits/stdc++.h> usin ...

  7. 2019牛客多校第一场 I Points Division(动态规划+线段树)

    2019牛客多校第一场 I Points Division(动态规划+线段树) 传送门:https://ac.nowcoder.com/acm/contest/881/I 题意: 给你n个点,每个点有 ...

  8. 牛客多校第一场 B Inergratiion

    牛客多校第一场 B Inergratiion 传送门:https://ac.nowcoder.com/acm/contest/881/B 题意: 给你一个 [求值为多少 题解: 根据线代的知识 我们可 ...

  9. HDU6581 Vacation (HDU2019多校第一场1004)

    HDU6581 Vacation (HDU2019多校第一场1004) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6581 题意: 给你n+1辆汽车, ...

随机推荐

  1. modelform 使用

    modelForm (1) model的知识点: class UserInfo(AbstractUser): tel = models.CharField(max_length=32) gender ...

  2. topcoder SRM712 Div1 LR

    题目: Problem Statement      We have a cyclic array A of length n. For each valid i, element i-1 the l ...

  3. mongodb研究(mongodb 内存数据库)

    本日志大部分都不是原创的转载复制的会带链接保持版权 工作中使用mongodb已经好久了,讽刺的是到了最后快离职的时候才有时间好好研究下源码.   印象:mongodb是一个内存数据库,数据都是放到内存 ...

  4. java之继承中的构造方法

    继承中的构造方法  1.子类的构造过程中必须调用其基类的构造方法. 2.子类可以在自己的构造方法中使用super(argument_list)调用基类的构造方法. 2.1.使用this(argumen ...

  5. 【VS Error】VS2008在编译时出现:Error 15 Cannot register assembly

    现象: 在visual studio 2008在编译类库时提示如下错误: Error 15 Cannot register assembly "D:\01_Work\02_SVN\OCRpl ...

  6. Helloworld.JaVa 第一次编程

    package Jc; class Jc1st { public static void main(String[] args) { System.out.println("Hello Wo ...

  7. z-albert之开启博文之路

    其实注册博客园已经蛮久的了,一直都只是停留在看,却没有自己动手一篇属于自己的技术博文.之所以以前一直没写,以前没有工作,一直都是小白.然而今天为什么感写了呢,并不是自己比以前懂得多多少,而是希望将自己 ...

  8. myEclipse项目转成Eclipse项目

    这里说一种把myEclipse项目转成Eclipse项目继续开发 1.  请首先确保你的eclipse是javaee版本的,或者已经安装看wtp插件 2.  然后修改eclipse工程下的.proje ...

  9. IPTABLES拒绝某个IP某项服务,并记录到日志(rhel7实例)

    #iptables -I INPUT -p icmp -s 192.168.0.1 -j DROP                 \\在INPUT链中插入:如果检测到从192.168.0.1发过来的 ...

  10. 虚拟机网卡名称修改为 eth0

    默认网卡名称是 eno16777736 1.修改配置文件 ifcfg-eno16777736 [root@localhost ~]# cd /etc/sysconfig/network-scripts ...