Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么是Run time error?

Posted by vikeydr at 2008-07-19 13:36:49 on Problem 2387
In Reply To:为什么是Run time error? Posted by:sanpin at 2006-11-20 19:12:40
我也是莫名其妙的RUN TIME ERROR,不过我的是PASCAL.大牛来看看。
program pku2367(input,output);
var
 x,y,z,i,t,n,j,p:integer;
 min:longint;
 a:array[1..1000,1..1000] of integer;
 d:array[1..1000] of longint;
 used:array[1..1000] of boolean;
begin
 readln(t,n);
 for i:=1 to t do for j:=1 to t do a[i,j]:=maxint;
 for i:=1 to t do
 begin
  readln(x,y,z);
  if z<a[x,y] then begin a[x,y]:=z;a[y,x]:=z;end;
 end;
 for i:=1 to n do d[i]:=a[1,i];
 fillchar(used,sizeof(used),false);
 used[1]:=true;
 for i:=1 to n-1 do
 begin
  min:=maxlongint;
  for j:=1 to n do
  if (not used[j]) and (d[j]<min ) then begin min:=d[j];p:=j;end;
  used[p]:=true;
  for j:=1 to n do
  if (not used[j]) and (a[p,j]<>maxlongint) then
   if d[p]+a[p,j]<d[j] then d[j]:=d[p]+a[p,j];
 end;
 writeln(d[n]);
end.



Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator