HDU 多校 VIII 1008 clock
来源:互联网 发布:淘宝花草茶 那么便宜 编辑:程序博客网 时间:2024/05/22 06:23
Clock
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 377 Accepted Submission(s): 200
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每行输出数据末尾均应带有空格
/* * In the name of god (^_^) */#pragma comment(linker, "/STACK:1024000000,1024000000")#include<cstdio>#include<cmath>#include<stdlib.h>#include<map>#include<set>#include<time.h>#include<vector>#include<queue>#include<string>#include<string.h>#include<iostream>#include<algorithm>using namespace std;#define eps 1e-8#define PI acos(-1.0)#define INF 0x3f3f3f3f#define LL long long#define max(a,b) ((a)>(b)?(a):(b))#define min(a,b) ((a)<(b)?(a):(b))typedef pair<int , int> pii;int h, m, s;int t[4];int ans[3];int gcd(int a, int b){ return b == 0 ? a : gcd(b, a % b);}int main(){ int T; scanf("%d", &T); while(T--) { scanf("%d:%d:%d", &h, &m, &s); t[3] = s * 720; t[2] = m * 720 + s * 12; t[1] = (h % 12) * 3600 + m * 60 + s; ans[0] = abs(t[1] - t[2]); ans[1] = abs(t[1] - t[3]); ans[2] = abs(t[2] - t[3]); for(int i = 0; i < 3; i++) { if(ans[i] > 180 * 120) ans[i] = 360 * 120 - ans[i]; if(ans[i]%120 == 0) printf("%d ", ans[i]/120); else { int tmp = gcd(ans[i], 120); printf("%d/%d ", ans[i]/tmp, 120/tmp); } } printf("\n"); } return 0;}/*400:00:0006:00:0012:54:5504:40:00*/
1 0
- HDU 多校 VIII 1008 clock
- hdu 5387 Clock 多校
- HDU 2184 汉诺塔VIII
- 多校-1008-Clock
- HDU 5387(2015多校8)-Clock(模拟)
- VIII
- HDU 1209 ( Clock )
- HDU 1393 Weird Clock
- HDU 1209 Clock
- hdu 1209 Clock
- HDU 1393 Weird Clock
- hdu 1393 Weird Clock
- hdu 1393 Weird Clock
- hdu 5387 Clock
- hdu 5387 Clock
- HDU 5387 Clock
- HDU 5387 Clock
- HDU 5387 Clock // 模拟
- 彻底掌握Quartus——Signaltap篇
- 事件处理机制之epoll
- 使用逆波兰式进行表达式求值
- 核心技术-接口1
- EasyUI----DataGrid 导出 Excel
- HDU 多校 VIII 1008 clock
- 关于文件异步上传
- 进程与线程的一个简单解释
- gradle 配置文件 build.gradle 属性详解
- coj 1343: Long Long
- DOM总结
- mybatis快速入门
- 类初始化与类对象初始化
- KMP算法