Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
汗……RUNTIME ERROR怎么回事?自家电脑上好好的啊……program poj3625_road; var v:array [1..1000] of real; map:array [1..1000,1..1000] of real; pnt:array [1..1000,1..2] of longint; i,j,k:longint; p:array [1..1000] of boolean; min,cost:real; minn,n,m:longint; function dist(x1,y1,x2,y2:longint):real; begin dist:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); end; begin fillchar(p,sizeof(p),false); fillchar(pnt,sizeof(pnt),0); readln(n,m); for i:=1 to n do readln(pnt[i,1],pnt[i,2]); for i:=1 to n do for j:=1 to n do if i<>j then map[i,j]:=dist(pnt[i,1],pnt[i,2],pnt[j,1],pnt[j,2]) else map[i,j]:=2000000; for i:=1 to m do begin readln(j,k); map[j,k]:=0; map[k,j]:=0; end; v:=map[1]; p[1]:=true; min:=2000000; cost:=0; for i:=2 to n do begin min:=2000000; for j:=1 to n do if (p[j]=false) and (min>v[j]) then begin min:=v[j];minn:=j; end; v[minn]:=2000000; for j:=1 to n do if (map[minn,j]<v[j]) and (p[j]=false) then v[j]:=map[minn,j]; p[minn]:=true; cost:=cost+min; end; writeln(cost:2:2); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator