比赛 20120717 评测结果 AAATTTTTTT
题目名称 信使问题b 最终得分 30
用户昵称 Makazeu 运行时间 3.719 s
代码语言 C++ 内存使用 4.22 MiB
提交时间 2012-07-17 09:30:47
显示代码纯文本
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;
int N;
const int MAXN=100100;
double point[MAXN][2];

inline double get(int i,int j)
{
	double x=(point[i][0]-point[j][0])*(point[i][0]-point[j][0]);
	double y=(point[i][1]-point[j][1])*(point[i][1]-point[j][1]);
	return sqrt(x+y);
}

inline void init()
{
	scanf("%d\n",&N);
	for(int i=1;i<=N;i++)
		scanf("%lf %lf\n",&point[i][0],&point[i][1]);
}

inline double Max(double a,double b)
{
	return a>b?a:b;
}

inline double Min(double a,double b)
{
	return a<b?a:b;
}

inline void baori()
{
	double max=double(0);
	double min=1e10;
	double tmp;
	for(int i=1;i<=N;i++)
	{
		for(int j=i+1;j<=N;j++)
		{
			tmp=get(i,j);
			max=Max(max,tmp);
			min=Min(min,tmp);
		}
	}
	printf("%.4lf\n%.4lf\n",max,min);
}

int main()
{
	//freopen("in","r",stdin);
	freopen("postmanb.in","r",stdin);
	freopen("postmanb.out","w",stdout);
	init();
	baori();
	return 0;
}