时针分针夹角大小

忘记有23点了。。。花了好长时间看;

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace  std;
int main()
{
	int n,i,j;
	double h,m,s;
	scanf("%d",&n);
	double a,b,c;
	while(n--)
	{
		scanf("%lf%lf%lf",&h,&m,&s);
		h=(int)h%12;
		m=m+s/60;
		h=h+m/60;
		m=m/5;
	//	printf("%f    %f\n",h,m);
		double x=fabs(m-h);
		x=min(x,(12-x));
		x=x*30;
		int t=x/0.1;
		t/=10;
		printf("%d\n",t);
	}
	return 0;
}


 

猜你喜欢

转载自blog.csdn.net/weixin_43916298/article/details/85052241
今日推荐