您的位置:首页 > 其它

URAL 1640 — Circle of Winter

2015-04-04 20:59 369 查看
原题:http://acm.timus.ru/problem.aspx?space=1&num=1640

题意:求一个合适的点(该点不能和题给的点重合)释放冰圈,使得给出的点中,至少一个点在圆上,其余均在圆内;
因为所给点的绝对值不超过1000,而冰圈的半径最多为10000;
所以直接以点(1005, 1005)为圆心释放冰圈即可,圆心和题给点最远的距离即为半径;
题意理解了,就很水了 *^-^*

#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	while(scanf("%d", &n)!=EOF)
	{
		double x = 1005, y = 1005;
		double a, b;
		double r = -1;
		while(n--)
		{
			scanf("%lf%lf", &a, &b);
			double dis = sqrt(pow(x-a, 2.0)+pow(y-b, 2.0));
			if(r<dis)
				r = dis;
		}
		printf("%f %f %.9f\n", x, y, r);
	}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: