uva579 计算几何入门

题目链接: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;
}


你可能感兴趣的:(ACM,uva,计算几何,uva579)