#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int h,m,s,n,i;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %d %d",&h,&m,&s);
double x,y,degree;
x = (1.0/120)*(m*60+s);
y = 0.1*((m%5)*60+s);
if (h>12)
h = h - 12;
m = m/5;
if (h==m)
degree = abs(x-y);
if (h<m)
degree = (m-h)*30-x+y;
if (h>m)
degree = (h-m)*30-y+x;
if (degree>180.00)
degree = 360 - degree;
printf("%d\n",(int)degree); //注意不能使用%.0lf因为那样会自动四舍五入,所以用强制类型转换
}
return 0;
}
#include <stdlib.h>
#include <math.h>
int main()
{
int h,m,s,n,i;
scanf("%d",&n);
for (i=0;i<n;i++)
{
scanf("%d %d %d",&h,&m,&s);
double x,y,degree;
x = (1.0/120)*(m*60+s);
y = 0.1*((m%5)*60+s);
if (h>12)
h = h - 12;
m = m/5;
if (h==m)
degree = abs(x-y);
if (h<m)
degree = (m-h)*30-x+y;
if (h>m)
degree = (h-m)*30-y+x;
if (degree>180.00)
degree = 360 - degree;
printf("%d\n",(int)degree); //注意不能使用%.0lf因为那样会自动四舍五入,所以用强制类型转换
}
return 0;
}