比赛 20110318 评测结果 AAAAAAAAAT
题目名称 公路修建 最终得分 90
用户昵称 donny 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-03-18 19:52:22
显示代码纯文本
program roads;
var
	i,j:longint;
	l:extended;
	n:longint;
	x,y:array[1..5000]of extended;
	q:array[1..5000]of extended;
	p:array[1..5000]of longint;
	o,max:extended;
	
begin
	assign(input,'roadz.in');
	reset(input);
	assign(output,'roadz.out');
	rewrite(output);
	
	readln(n);
	for i:=1 to n do
	begin
		readln(x[i],y[i]);
	end;
		
	for i:=1 to n do
	begin
		q[i]:=999999999999999;
		p[i]:=1001;
	end;
	max:=0;
	q[1]:=0;
	j:=1;
	l:=0;
	
	while l<>9999999999 do
	begin
		p[j]:=0;
		for i:=1 to n do
		begin
			if p[i]<>0 then
			begin
				o:=sqrt(sqr(x[j]-x[i])+sqr(y[j]-y[i]));
				if o<q[i] then
				begin
					q[i]:=o;
					p[i]:=j;
				end;
			end;
		end;
		
		l:=9999999999;
		for i:=1 to n do
		begin
			if p[i]<>0 then
				if q[i]<l then 
				begin
					l:=q[i];
					j:=i;
				end;
		end;
		if l<>9999999999 then
			max:=max+q[j];
	end;
	max:=round(max*100)/100;
	writeln(max:0:2);
	
	close(input);
	close(output);
end.