【杭电】[2076]夹角有多大

文章字数:122

问题描述

问题分析

真是一比赛整个人都不一样了
题目已经提示了
转动是连续的而不是离散的
所以需用double来记录小数

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
#include<stdio.h>
#include<math.h>
int main() {
	int T;
	scanf("%d",&T);
	while(T--) {
		int h,m,s;
		scanf("%d %d %d",&h,&m,&s);
		h%=12;
		double tm=s/10.0+m*6.0;
		double th=h*30.0+tm/12.0;
		double res=fabs(th-tm);
		if(res>360-res)
			res=360-res;
		printf("%d\n",(int)res);
	}
	return 0;
}

题目地址:【杭电】[2076]夹角有多大

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...