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 |
最后一次来POJ,回复一下当年的帖子In Reply To:为什么COMPILE ERROR? Posted by:cuiaoxiang at 2003-07-02 11:04:08 > 程序在FREE PASCAL 上运行正常,应该没错。 > > var a:array[1..20,1..20,0..1]of int64; > b:array[1..20]of byte; > c,total:int64; > n,i,k,fence:integer; > t:byte; > procedure init; > var i,j,k:integer; > begin > a[1,1,0]:=1;a[1,1,1]:=1; > for i:=2 to n do > for j:=1 to i do > begin > a[i,j,0]:=0; > for k:=1 to j-1 do > a[i,j,0]:=a[i,j,0]+a[i-1,k,1]; > a[i,j,1]:=0; > for k:=j to i-1 do > a[i,j,1]:=a[i,j,1]+a[i-1,k,0]; > end; > for i:=1 to n do > b[i]:=i; > end; > > procedure check(m:integer); > var i,j,ii:integer; sum:int64; > begin > if m=1 then begin writeln(b[1]); exit; end; > if m=n > then begin > i:=0;sum:=0; > while sum<c do > begin > inc(i); > ii:=(i+i mod 2)div 2; > sum:=sum+a[m,ii,1-i mod 2]; > end; > write(b[ii],' '); > for j:=ii to m-1 do > b[j]:=b[j+1]; > c:=c+a[m,ii,1-i mod 2]-sum; > t:=i mod 2; > fence:=ii; > check(m-1); > end > else begin > i:=0; > sum:=0; > while sum<c do > begin > inc(i); > if ((b[i]>fence)and (t=0))or ((b[i]<fence)and (t=1)) > then sum:=sum+a[m,i,t]; > end; > write(b[i],' '); > fence:=b[i]; > for j:=i to m-1 do > b[j]:=b[j+1]; > c:=c+a[m,i,t]-sum; > t:=1-t; > check(m-1); > end; > end; > > begin > readln(k); > for i:=1 to k do > begin > readln(n,c); > init; > check(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