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 25278RQ at 2004-05-05 14:24:01 on Problem 1028
var
  temp2,t2,j,t1,t:integer;
  a,d:array [1..100] of string;
  b:array [1..100] of integer;
  c,e:array [1..100] of boolean;

procedure init;
var
  ch,ch1:char;
  i:integer;
begin
  t:=1;
  a[1]:='http://www.acm.org/';
  fillchar(c,sizeof(c),false);
  c[1]:=true;
  repeat
    read(ch);
    case ch of
      'V':begin
            for i:=1 to 5 do
              read(ch1);
            inc(t1);
            b[t1]:=0;
            inc(t);
            read(a[t]);
            c[t]:=true;
          end;
      'B':begin
            readln;
            inc(t1);
            b[t1]:=-1;
          end;
      'F':begin
            readln;
            inc(t1);
            b[t1]:=1;
          end;
      'Q':begin
            readln;
            inc(t1);
            b[t1]:=2;
          end;
    end;
  until ch='Q';
end;

procedure work;
var
  i:integer;
begin
  j:=1;
  t2:=1;
  temp2:=1;
  d[1]:='http://www.acm.org/';
  for i:=1 to t1 do
    begin
      if b[i]=0 then
         begin
           fillchar(e,sizeof(e),true);
           inc(j);
           writeln(a[j]);
           inc(t2);
           temp2:=t2;
           d[t2]:=a[j];
           c[t2]:=true;
           e[t2]:=false;
         end;
      if b[i]=1 then if (c[temp2+1])and(e[temp2]) then
        begin
          inc(temp2);
          inc(t2);
          d[t2]:=d[temp2];
          writeln(d[t2]);
          c[t2]:=true;
        end
        else writeln('Ignored');
      if b[i]=-1 then if c[temp2-1] then 
        begin
          inc(t2);
          d[t2]:=d[temp2-1];
          temp2:=temp2-1; 
          writeln(d[t2]); 
          c[t2]:=true;
        end
        else writeln('Ignored');
      if b[i]=2 then halt;
    end;
end;

begin
  init;
  work;
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