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:现在看pascal跟甲骨文似的...In Reply To:这体怎么会错?谁来帮帮我!!! Posted by:My_loves at 2005-08-22 14:48:17 > {$N+} > program Ball; > var N,M:byte; > Nail:array [1..50,1..50] of byte; > Poss:array [0..50,0..50] of comp; > > procedure init; > var i,j:byte; > c:char; > begin > readln(N,M); > for i:=1 to N do > for j:=1 to i do > begin > repeat > read(c); > until c in ['*','.']; > if c='*' then Nail[i,j]:=1 > else Nail[i,j]:=0; > end; > end; > > procedure main; > var i,j:byte; > begin > fillchar(Poss,sizeof(Poss),0); > Poss[0,0]:=1; > for i:=1 to N do > Poss[0,0]:=Poss[0,0]*2; > for i:=0 to N-1 do > for j:=0 to i do > if Nail[i+1,j+1]=0 then Poss[i+2,j+1]:=Poss[i+2,j+1]+Poss[i,j] > else begin > Poss[i+1,j]:=Poss[i+1,j]+Poss[i,j]/2; > Poss[i+1,j+1]:=Poss[i+1,j+1]+Poss[i,j]/2; > end; > end; > > procedure outit; > var a,b:comp; > begin; > a:=Poss[N,M]; > if a=0 then writeln('0/1') > else begin > b:=a/2; > while b*2=a do > begin > a:=b; b:=a/2; > Poss[0,0]:=Poss[0,0]/2; > end; > writeln(a:0:0,'/',Poss[0,0]:0:0); > end; > end; > > begin > init; > main; > outit; > end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator