- Kerry 的电缆网络
- 2012-10-24 11:58:10 @
type bian=record a,b:longint; l:real; end;
var x,y,n,m:longint;
i,j:longint;
c:array[0..1000000] of bian;
f:array[0..1000000] of longint;
ans,s:real;
procedure qsort(l,r:longint);
var i,j:longint;
y,t:bian;
begin
i:=l;j:=r;t:=c[(i+j) div 2];
repeat
while c[j].lt.l do inc(i);
if ij;
if j>l then qsort(l,j);
if is then writeln('Impossible');
writeln('Need ',ans:0:2,' miles of cable');
end;
begin
readln(s); readln(n); m:=0;
while not eof do
begin
readln(c[m+1].a,c[m+1].b,c[m+1].l);
inc(m);
end;
qsort(1,m);
for i:=1 to m do f[i]:=i;
i:=m;
while (i>=1) and (j
1 条评论
-
201572 LV 4 @ 2018-06-24 16:24:53
我也是
- 1