| ||||||||||
| 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 | |||||||||
求出错的地方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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator