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
 

Input

There are $T$$(1\leq T \leq 10^4)$ test cases 
for each case,one line include the time

$0\leq hh<24$,$0\leq mm<60$,$0\leq ss<60$

 

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

4
00:00:00
06:00:00
12:54:55
04:40:00
 

Sample Output

0 0 0
180 180 0
1391/24 1379/24 1/2
100 140 120

Hint

每行输出数据末尾均应带有空格 

题意:

求给定时间点的时针、分针、秒针的夹角(分数、角度制)

分析:

tol=总秒数,时针1/120 °/s,分针1/10 °/s,秒针 6 °/s,

分针和时针转过的角度差(tol/10-tol/120)=11*tol/120;

秒针和时针转过的角度差(6*tol-tol/120)=719*tol/120;

秒针和分针转过的角度差(6*tol-tol/10)=59*tol/10;

然后前两个角度差的分子%(120*360)即%43200,后面一个%3600,这样就<360了,就是我们要求的夹角或其补角了。

然后判断夹角up/down 是否大于180度,刚开始我让它>180就360减去它,但是 这里是整除,也就是180多一点点的整除了变成180,所以要写成>=180或>179时就让360减去它。

接下来约分输出。

代码:

 #include<stdio.h>
int t,h,m,s,tol,up[],down[],g;
int gcd(int a,int b)
{return b?gcd(b,a%b):a;}
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d:%d:%d",&h,&m,&s);
tol=h*+m*+s;
up[]=(*tol)%();
up[]=(*tol)%();
up[]=(*tol)%();
down[]=down[]=;down[]=;
for(int i=; i<; i++)
{
g=gcd(up[i],down[i]);
up[i]/=g;down[i]/=g;
if(up[i]/down[i]>)up[i]=down[i]*-up[i];
if(down[i]==)printf("%d ",up[i]);
else printf("%d/%d ",up[i],down[i]);
}
printf("\n");
}
return ;
}
05-04 03:14