Total Submission(s): 13233 Accepted Submission(s): 5214
注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的。
每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时、分、秒。
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<iostream>
#define INF 0x3f3f3f3f
#define ll long long
#define IN __int64
#define N 1010
#define M 1000000007
using namespace std;
int main()
{
int t;
double h,m,s;
scanf("%d",&t);
while(t--)
{
double j1,j2;
double mm,hh;
scanf("%lf%lf%lf",&h,&m,&s);
if(h>12)
h-=12;
mm=m+s/60;j1=mm*6;
hh=h+mm/60;j2=hh*5*6;
double ans=fabs(j1-j2);
if(ans>180)
printf("%d\n",(int)(360-ans));
else
printf("%d\n",(int)ans);
}
return 0;
}