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

求出错的地方

Posted by xxxxxx at 2014-05-15 19:29:02
program f99;
var
  id,m,rx,ry,i:longint;
  x,y,f:array[0..10000] of longint;

  function find(x:longint):longint;
  begin
    if find(x)=x then exit(x);
    find:=find(find(x));
    end;
begin
  id:=0;
  while true do begin
    inc(id);
    read(x[1],y[1]);
    if (x[1]=-1)and(y[1]=-1) then break;
    while x[m]+y[m]>0 do begin
     read(x[m],y[m]);
     inc(m);
     end;
      dec(m);  for i:=1 to m do begin
      f(rx):=find(x[m]);
      f(ry):=find(y[m]);
      if rx=ry then break;
      f[rx]:=ry;
      end;
    if m=1 then writeln('Case',' ',id,' ','is a tree.')
    else writeln('Case',' ',id,' ','is not a tree.');
end;
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