记录编号 240070 评测结果 AAWAWWWAAA
题目名称 [NOIP 2007]字符串的展开 最终得分 60
用户昵称 GravatarHamster 是否通过 未通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2016-03-21 15:38:24 内存使用 0.17 MiB
显示代码纯文本
program ex;
var
  s:string;
  p1,p2,p3,l,i,i1,i2,b:integer;
begin
  assign(input,'expand.in');
  assign(output,'expand.out');
  reset(input);
  rewrite(output);

  readln(p1,p2,p3);
  readln(s);

  l:=length(s);
  i:=1;
  while i<=l do
  begin
    if s[i]='-' then
    begin
      if s[i-1]>=s[i+1] then
      begin
        write('-');
        i:=i+1;
      end
      else if succ(s[i-1])=s[i+1] then i:=i+1
      else
      begin
        if p1=1 then
        begin
          if p3=1 then
          for i1:= 1 to (ord(s[i+1])-ord(s[i-1])-1) do
            for i2:=1 to p2  do write(chr(ord(s[i-1])+i1))
          else for i1:= (ord(s[i+1])-ord(s[i-1])-1) downto 1 do
            for i2:=1 to p2  do write(chr(ord(s[i-1])+i1))
        end
        else
        if p1=2 then
        begin
          if p3=1 then
          for i1:= 1 to (ord(s[i+1])-ord(s[i-1])-1) do
            for i2:=1 to p2  do write(chr(ord(s[i-1])+i1-32))
          else for i1:= (ord(s[i+1])-ord(s[i-1])-1) downto 1 do
            for i2:=1 to p2  do write(chr(ord(s[i-1])+i1-32))
        end
        else if p1=3 then
          for i1:= (ord(s[i+1])-ord(s[i-1])-1) downto 1 do
            for i2:=1 to p2  do write('*');
        i:=i+1;
      end;
    end
    else
    begin
      write(s[i]);
      i:=i+1;
    end;
  end;




  close(input);
  close(output);
end.