比赛 20121030 评测结果 AAAAAAAAAA
题目名称 外星密码 最终得分 100
用户昵称 舍得 运行时间 0.003 s
代码语言 Pascal 内存使用 0.26 MiB
提交时间 2012-10-30 21:18:41
显示代码纯文本
 var a:array[1..100000] of char;
      i,j,n,len,m,p,q,x,y:longint;
      ch:char;
  function getnum(x:longint;var pos:longint):longint;
    var k,t,i:longint;
    begin
      i:=x;
      t:=0;
      while a[i] in ['0'..'9'] do
        begin
          t:=t*10+ord(a[i])-ord('0');
          inc(i);
        end;
      pos:=i;
      getnum:=t;
    end;

  function make(x:longint):longint;
    var i,j,k,t,delta,pos:longint;
    begin
      i:=x;
      while true do
        begin
          if a[i]=']' then exit(i);
          if a[i]<>'[' then write(a[i])
            else
              begin
                k:=getnum(i+1,pos);
                for j:=1 to k do
                  begin
                    t:=make(pos);
                  end;
                i:=t;
              end;
          inc(i);
        end;
    end;

  begin
    assign(input,'passworda.in');
    reset(input);
    assign(output,'passworda.out');
    rewrite(output);
    len:=0;
    while not(eoln) do
      begin
        inc(len);
        read(ch);
        a[len]:=ch;
      end;
    a[LEN+1]:=']';
    make(1);
    writeln;
    close(Input);
    close(output);
  end.