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

555555555555 Why I got WA

Posted by orange at 2003-10-12 18:14:04 on Problem 1321
给个特殊点的数据把var use:array[1..8] of integer;
    s:array[1..8] of string[8];
    n,k,ans:integer;

procedure init;
var i,j:integer;
    ch:char;
begin
  fillchar(use,sizeof(use),0);
  fillchar(s,sizeof(s),' ');
  for i:=1 to n do readln(s[i]);
  ans:=0;
end;

procedure work(step,y:integer);
var i:integer;
begin
  if step=k+1 then inc(ans)
  else if y=n+1 then exit
  else for i:=0 to n do
    if i=0 then work(step,y+1)
    else
      if (use[i]=0) and (s[y,i]='#') then begin
        use[i]:=1;
        work(step+1,y+1);
        use[i]:=0;
      end;
end;

begin
  readln(n,k);
  while (n<>-1) do begin
    init;
    work(1,1);
    writeln(ans);
    readln(n,k);
  end;
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