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 |
Re:麻烦各位大牛给看一下怎么runtime error了(附:程序)In Reply To:Re:麻烦各位大牛给看一下怎么runtime error了(附:程序) Posted by:LUXUFENG at 2011-08-04 11:11:19 var b:array[0..200,0..200] of longint; > c:array[0..200] of string; > d,x,e,r:array[0..200] of longint; > s,s1:string; > fl:boolean; > n,i,js,j,k,max,jt:longint; > > > > procedure djs(xt:integer); > var i:integer; > begin > for i:=1 to x[xt] do > begin > d[b[xt,i]]:=d[xt]+1; > djs(b[xt,i]); > end; > end; > > > begin > readln(n); > while n<>0 do > begin > readln(c[1]); > d[1]:=1;js:=1; > for i:=1 to n-1 do > begin > readln(s); > s1:=copy(s,pos(' ',s)+1,length(s)-pos(' ',s)); > delete(s,pos(' ',s),length(s)-pos(' ',s)+1); > fl:=false; > for j:=1 to js do > if c[j]=s then > begin > fl:=true; > jt:=j; > end; > if not fl then > begin > js:=js+1; > jt:=js; > c[js]:=s; > end; > fl:=false; > for j:=1 to js-1 do > if c[j]=s1 then > begin > fl:=true; > x[j]:=x[j]+1; > b[j,x[j]]:=jt; > end; > if not fl then > begin > inc(js); > c[jt]:=s1; > x[jt]:=1; > b[jt,1]:=jt-1; > end; > end; > fl:=false; > max:=0; > for i:=1 to n do > begin > e[i]:=1; > r[i]:=0; > end; > djs(1); > > for i:=1 to n do > if d[i]>max then > max:=d[i]; > for i:=max downto 1 do > for j:=1 to n do > if d[j]=i then > for k:=1 to x[j] do > begin > if e[b[j,k]]>r[b[j,k]] then r[j]:=r[j]+e[b[j,k]] > else r[j]:=r[j]+r[b[j,k]]; > > e[j]:=e[j]+r[b[j,k]]; > end; > if e[1]>r[1] then write(e[1],' ') > else write(r[1],' '); > if e[1]=r[1] then writeln('No') > else writeln('Yes'); > for i:=1 to n do > x[i]:=0; > readln(n); > end; > end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator