#8258:


jasonhaha (HALA Madrid)

學校 : 华东师范大学第二附属中学
編號 : 14731
來源 : [184.147.60.142]
最後登入時間 :
2019-04-15 10:10:34
d198. 00825 - Walking on the Safe Side -- UVa825 | From: [58.35.69.148] | 發表日期 : 2013-10-01 20:41

var
  f:array[0..100,0..100]of boolean;
  ans:array[0..100,0..100]of int64;
  i,j,a,b,n,k,x,y:longint;
begin
  while not eof do begin
    readln(n);
    if n=0 then break;
    readln;
    for k:=1 to n do begin
      fillchar(f,sizeof(f),true);
      fillchar(ans,sizeof(ans),0);
      readln(a,b);
      if((a=0)or(b=0)) then break;
      for i:=0 to a do f[i,0]:=false;
      for i:=0 to b do f[0,i]:=false;
      ans[1,1]:=1;
      for i:=1 to a do begin
        read(x);
        while not eoln do begin
          read(y);
          f[x,y]:=false;
        end;
      end;
      for i:=1 to a do
        for j:=1 to b do begin
          if((i=1)and(j=1)) then continue;
          if f[i,j]=true then ans[i,j]:=ans[i-1,j]+ans[i,j-1];
        end;
      writeln(ans[a,b]);
      if k<>n then writeln;
    end;
  end;
end.
为什么会OLE?? 
 
ZeroJudge Forum