比赛 |
暑假培训一 |
评测结果 |
|
题目名称 |
字符串的展开 |
最终得分 |
0 |
用户昵称 |
chengyang |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-07-17 14:33:54 |
显示代码纯文本
program expand(f1,f2);
var
s1,s2,s3,s4:string;
p1,p2,p3,i,j,n,x,y,h,k,v:integer;
f1,f2:text;
procedure pp3;
begin
if p3=1 then begin
s4:=s3[2]; delete(s3,2,1);
for i:=x+1 to y-1 do begin
for j:=1 to p2 do begin
if v=1 then s3:=s3+'*'
else s3:=s3+chr(i);
end;
end;
s3:=s3+s4;
end
else begin
for i:=y-1 downto x+1 do begin
for j:=1 to p2 do
if v=1 then insert('*',s3,2)
else insert(chr(i),s3,2);
end;
end;
end;
procedure pp2;
begin
x:=ord(s3[1]); y:=ord(s3[2]);
if p1=3 then begin v:=1;pp3;end
else pp3;
end;
procedure pp1;
begin
if p1=1 then begin x:=ord(s3[1]); y:=ord(s3[2]);pp3; end
else if p1=2 then begin x:=ord(s3[1])-32; y:=ord(s3[2])-32;pp3;end
else pp2;
end;
procedure cl;
begin
h:=ord(s3[3]);k:=ord(s3[1]);v:=0;
if (h>=48)and(h<=57)and(k>=48)and(k<=57)and(h>k)then begin
delete(s3,2,1);
if h-k>1then pp2;
end
else begin
if (h>=97)and(h<=122)and(k>=97)and(k<=122)and(h>=k)then begin
delete(s3,2,1);
if h-k>1then pp1;
end;
end;
end;
begin
assign(f1,'expand.in');
assign(f2,'expand.out');
reset(f1); rewrite(f2);
read(f1,p1,p2,p3);
readln(f1);
readln(f1,s1);
repeat
n:=pos('-',s1);
s2:=s2+copy(s1,1,n-2);
delete(s1,1,n-2);
s3:=copy(s1,1,3);
delete(s1,1,3);
cl;
s2:=s2+s3;
n:=pos('-',s1);
until n=0;
s2:=s2+s1;
writeln(f2,s2);
close(f1); close(f2);
end.