- Kerry 的电缆网络
- 2009-07-07 15:03:56 @
128错误是什么意思 `我新手\
`一个朴素的最小树``大牛帮解释下为什么错误128?
program xx;
var num:set of char=['0'..'9'];
map:array[1..1000,1..1000]of real;
min:real;
i,j,n,k,l:longint;
s,w,x:real;
mincost:array[1..1000]of real;
costed:array[1..1000]of longint;
begin
fillchar(mincost,sizeof(mincost),0);
fillchar(costed,sizeof(costed),0);
readln(s);
readln(n);
for i:=1 to n do
for j:=1 to n do
map:=32767;
while not eof do
begin
readln(i,j,w);
map:=w;
map[j,i]:=w;
end;
for i:=1 to n do
begin
mincost[i]:=map[1,i];
costed[i]:=1;
end;
for l:=2 to n do
begin
min:=32767;
for i:=1 to n do
if (mincost[i]map[k,j]) and (mincost[j]0) then
begin
mincost[j]:=map[k,j];
costed[j]:=k;
end;
end;
min:=0;
for i:=2 to n do
min:=map[costed[i],i]+min;
if min>s then write('Impossible')
else write('Need',' ',min:0:2,' miles of cable');
end.
1 条评论
-
Aule LV 9 @ 2009-07-18 22:35:47
数组读超了
- 1