您的位置:首页 > 其它

uva579 计算几何入门

2013-03-30 20:37 435 查看
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=101&problem=520&mosmsg=Submission+received+with+ID+11532034

题意:给出时针和分针,输出夹角。。。

#include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
#define min(a,b)	((a)<(b)?(a):(b))
int main()
{
	int a, b;
	while (scanf("%d:%d", &a, &b), a || b)
	{
		if (a == 12) a-= 12;
		double x, y;
		y = b;
		x = a * 5.0 + y / 60.0 * 5.0;
		double cha = fabs(x - y);
		if (cha > 30.0) cha = 60 - cha;
		printf("%.3lf\n", cha * 6.0);
	}
	return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: