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 My_loves at 2005-08-22 14:48:17 on Problem 1189
{$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:
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