hdu 5387 Clock 2015多校联合训练赛#8
来源:互联网 发布:mac pro 分辨率设置 编辑:程序博客网 时间:2024/05/03 00:50
Clock
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 328 Accepted Submission(s): 225
Problem Description
Give a time.(hh:mm:ss),you should answer the angle between any two of the minute.hour.second hand
Notice that the answer must be not more 180 and not less than 0
Notice that the answer must be not more 180 and not less than 0
Input
There are T (1≤T≤104) test cases
for each case,one line include the time
0≤hh<24 ,0≤mm<60 ,0≤ss<60
for each case,one line include the time
Output
for each case,output there real number like A/B.(A and B are coprime).if it's an integer then just print it.describe the angle between hour and minute,hour and second hand,minute and second hand.
Sample Input
400:00:0006:00:0012:54:5504:40:00
Sample Output
0 0 0 180 180 0 1391/24 1379/24 1/2 100 140 120Hint每行输出数据末尾均应带有空格
Source
2015 Multi-University Training Contest 8
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int gcd(int a,int b){ if(b == 0) return a; return gcd(b,a%b);}void work(int a,int b){ int u = 120*360; int f = ((a-b)%u+u)%u; f = min(f,u-f); u = 120; int g = gcd(f,u); u /= g; f /= g; if(u == 1) printf("%d ",f); else printf("%d/%d ",f,u);}int main(){ int t,h,m,s; scanf("%d",&t); while(t--){ scanf("%d:%d:%d",&h,&m,&s); h = h*60*60+m*60+s; m = m*12*60+s*12; s = s*12*60; work(h,m); work(h,s); work(m,s); printf("\n"); } return 0;}
0 0
- hdu 5387 Clock 2015多校联合训练赛#8
- 多校联合训练8&&HDU 5828
- hdu 5326 work 搜索 2015多校联合训练赛
- hdu 5417 RGCDQ 2015多校联合训练赛
- hdu 5406 2015 多校联合训练赛#10 dp
- hdu 5381 The sum of gcd 2015多校联合训练赛#8莫队算法
- hdu 5389 Zero Escape 2015多校联合训练赛#8 动态规划
- hdu 5384 Danganronpa 2015多校联合训练赛#8 ac自动机
- hdu 5385 The path 2015多校联合训练赛#8 bfs
- hdu 5386 Cover 2015多校联合训练赛#8 枚举
- 多校联合训练4&&HDU 5763
- 多校联合训练7&&HDU 5810
- hdu 5303 Delicious Apples 2015多校联合训练赛2 dp+枚举
- hdu 5338 ZZX and Permutations 2015多校联合训练赛,贪心,线段树,树状数组
- hdu 5327 Olympiad 简单题 2015多校联合训练赛
- hdu 5328 Problem Killer 2015多校联合训练赛4 简单题
- hdu 5330 Route Statistics 2015多校联合训练赛4 状态压缩
- hdu 5347 MZL's chemistry 2015多校联合训练赛#5 打表
- CallableStatement的实例
- 字符的排序(冒泡排序,选择排序)
- 如何应用QQ分享
- Codeforces 570 B. Simple Game ( 概率 )
- iOS中利用NSURLSession进行文件断点下载
- hdu 5387 Clock 2015多校联合训练赛#8
- 简易信息管理系统——增删改查知识总结
- OpenSessionInViewFilter解决数据库操作表(一对多)延迟加载时session关闭的异常
- C++11的线程库(二)
- html5 touch引发的一个应用以及营销
- 【再思考】linux中fork()函数详解
- 使用cocoadPod updating local specs repositories 卡住
- Could not find acceptable representation
- Oracle 导入dmp文件命令