讨论 / 写了179行 一次AC
L.Lawliet 2012-08-08 06:49:00
点我顶贴 收藏 删除
题目:字符串的展开

状态: Accepted

测评机: Xeond[6]

得分: 100分

提交日期: 2010-6-1 14:57:00

有效耗时: 703毫秒

测试结果1: 通过本测试点|有效耗时187ms

测试结果2: 通过本测试点|有效耗时47ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时47ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 通过本测试点|有效耗时62ms

测试结果7: 通过本测试点|有效耗时63ms

测试结果8: 通过本测试点|有效耗时62ms

测试结果9: 通过本测试点|有效耗时78ms

测试结果10: 通过本测试点|有效耗时63ms

type aa='a'..'z';

bb='A'..'Z';

cc='0'..'9';

var a:array[1..26]of char;

b:array[1..26]of char;

c:array[1..10]of char;

ch:char;

str:ansistring;

l:longint;

i,j,k,m,n:longint;

p1,p2,p3:integer;

flog:boolean;

{main}

begin

ch:='*';

for i:=1 to 26 do

begin

a[i]:=chr(ord('a')-1+i);

b[i]:=chr(ord('A')-1+i);

end;

for i:=1 to 10 do

c[i]:=chr(ord('0')-1+i);

readln(p1,p2,p3);

readln(str);

l:=length(str);

flog:=false;

// writeln(l);

for i:=1 to l-1 do

begin

if flog then

begin

flog:=false;

continue;

end;

if str[i+1]<>'-' then

begin

write(str[i]);

continue;

end;

m:=0;

n:=0;

for j:=1 to 26 do

begin

if a[j]=str[i] then

m:=j;

if a[j]=str[i+2] then

n:=j;

end;

if (m=0)xor(n=0) then

begin

write(str[i]);

continue;

end;

if m+n<>0 then

begin

if m+1=n then

begin

write(str[i]);

flog:=true;

continue;

end;

if n<=m+1 then

begin

write(str[i]);

continue;

end;

write(str[i]);

if p3=1 then

for j:=m+1 to n-1 do

for k:=1 to p2 do

begin

if p1=1 then write(a[j]);

if p1=2 then write(b[j]);

if p1=3 then write(ch);

end;

if p3=2 then

for j:=n-1 downto m+1 do

for k:=1 to p2 do

begin

if p1=1 then write(a[j]);

if p1=2 then write(b[j]);

if p1=3 then write(ch);

end;

flog:=true;

continue;

end;

for j:=1 to 26 do

begin

if b[j]=str[i] then

m:=j;

if b[j]=str[i+2] then

n:=j;

end;

if (m=0)xor(n=0) then

begin

write(str[i]);

continue;

end;

if m+n<>0 then

begin

if m+1=n then

begin

write(str[i]);

flog:=true;

continue;

end;

if n<=m+1 then

begin

write(str[i]);

continue;

end;

write(str[i]);

if p3=1 then

for j:=m+1 to n-1 do

for k:=1 to p2 do

begin

if p1=1 then write(a[j]);

if p1=2 then write(b[j]);

if p1=3 then write(ch);

end;

if p3=2 then

for j:=n-1 downto m+1 do

for k:=1 to p2 do

begin

if p1=1 then write(a[j]);

if p1=2 then write(b[j]);

if p1=3 then write(ch);

end;

flog:=true;

continue;

end;

for j:=1 to 10 do

begin

if c[j]=str[i] then

m:=j;

if c[j]=str[i+2] then

n:=j;

end;

if (m=0)xor(n=0) then

begin

write(str[i]);

continue;

end;

if m+n<>0 then

begin

if m+1=n then

begin

write(str[i]);

flog:=true;

continue;

end;

if n<=m+1 then

begin

write(str[i]);

continue;

end;

write(str[i]);

if p3=1 then

for j:=m+1 to n-1 do

for k:=1 to p2 do

begin

if p1=1 then write(c[j]);

if p1=2 then write(c[j]);

if p1=3 then write(ch);

end;

if p3=2 then

for j:=n-1 downto m+1 do

for k:=1 to p2 do

begin

if p1=1 then write(c[j]);

if p1=2 then write(c[j]);

if p1=3 then write(ch);

end;

flog:=true;

continue;

end;

end;

writeln(str[l]);

end.

#1 xijisoft@2010-06-01 02:53:00
回复 删除
orz
#2 zhoutian@2010-07-06 06:50:00
回复 删除
其实本不用这么长 没用的代码太多~
#3 sunjerry@2010-07-06 17:24:00
回复 删除
猛!!
#4 zsq19950208@2012-08-06 05:28:00
回复 删除
Orz
#5 -.->.<@2012-08-08 06:49:00
回复 删除
话说lz不会用过程吗?

rt。

查看更多回复
提交回复