记录编号 233 评测结果 AAAAAAAAAA
题目名称 [NOIP 2007]字符串的展开 最终得分 100
用户昵称 Gravatar打不死的羊 是否通过 通过
代码语言 Pascal 运行时间 10.000 s
提交时间 2008-07-17 17:50:25 内存使用 0.00 MiB
显示代码纯文本
program expand;
Var
p1,p2,p3,i,j,m,k,l:longint;
s:string;
f1,f2:text;
begin
assign(f1,'expand.in');
assign(f2,'expand.out');
reset(f1);rewrite(f2);
readln(f1,p1,p2,p3);
readln(f1,s);l:=length(s);
repeat
k:=pos('-',s);
if (k=1)or(k=l) then begin for i:=1 to k do write(f2,s[i]);
                           delete(s,1,k);
                           l:=length(s);end
                else begin
if k<>0 then begin
for i:=1 to k-1 do
write(f2,s[i]);
if ord(s[k-1])>=ord(s[k+1]) then write(f2,'-')
else begin if p3=1 then if ((s[k-1]in['0'..'9'])and(s[k+1]in['a'..'z']))or
                           ((s[k-1]in['0'..'9'])and(s[k+1]in['a'..'z']))
                           then write(f2,'-')
                           else
           for i:=ord(s[k-1])+1to ord(s[k+1])-1 do
            for j:=1 to p2 do
            begin  m:=i;
                   if p1=3 then write(f2,'*') else begin
                   if p1=2 then if m in[65..90] then m:=m+32
                           else if m in[97..122]then m:=m-32;
                           write(f2,chr(m));       end;
            end;
           if p3=2 then if ((s[k-1]in['0'..'9'])and(s[k+1]in['a'..'z']))or
                           ((s[k-1]in['0'..'9'])and(s[k+1]in['a'..'z']))
                           then write(f2,'-')
                           else
           for i:=ord(s[k+1])-1downto ord(s[k-1])+1 do
            for j:=1 to p2 do
            begin  m:=i;
                   if p1=3 then write(f2,'*') else begin
                   if p1=2 then if m in[65..90] then m:=m+32
                           else if m in[97..122]then m:=m-32;
                           write(f2,chr(m));       end;
            end;
      end;
delete(s,1,k);end
else write(f2,s);
l:=length(s);end;
until (l<=0)or(k=0);
close(f1);close(f2);
end.