终于AC了-----------代码有些长

program yx001;

var i,j,k,l,n,t,e:longint;

s1,s2,s3,s4,s5,s6:ansistring;

p,q:char;

ss4,ss5:array[0..6]of ansistring;

s:array[1..3,0..10000000]of char;

b:array[1..3]of boolean;

begin

assign(input,'string.in');

reset(input);

assign(output,'string.out');

rewrite(output);

s1:='';

s2:='';

s3:='';

s4:='';

s5:='';

s6:='';

readln(n);

for i:=1 to 3 do

begin

for j:=1 to n do

begin

read(s);

end;

readln;

end;

fillchar(b,sizeof(b),false);

for i:=1 to n do

begin

s1:=s1+s[1,i];

s2:=s2+s[2,i];

s3:=s3+s[3,i];

end;

for j:=n downto 1 do

begin

s[2,n-j+1]:=s2[j];

s[1,n-j+1]:=s1[j];

s[3,n-j+1]:=s3[j];

end;

for i:=0 to 6 do

begin

ss4[i]:='';

ss5[i]:='';

end;

for i:=1 to n do

begin

for k:=0 to 6 do

begin

l:=ord(s[1,i])+k;

if l=123 then

l:=l-26;

s4:=chr(l);

j:=ord(s[1,i])-k;

if j=123 then

j:=j-26;

s5:=chr(j);

for e:=0 to 6 do

if k=e then

begin

ss4[e]:=ss4[e]+s4;

ss5[e]:=ss5[e]+s5;

end;

end;

end;

for i:=0 to 6 do

begin

if (ss4[i]=s2) then

begin

if ss5[i]=s3 then

begin

b[1]:=true;

break;

end

else

b[1]:=false;

end

else

begin

if ss4[i]=s3 then

begin

if ss5[i]=s2 then

begin

b[1]:=true;

break;

end

else

b[1]:=false;

end

else

b[1]:=false;

end;

end;

for i:=0 to 6 do

begin

ss4[i]:='';

ss5[i]:='';

end;

for i:=1 to n do

begin

for k:=0 to 6 do

begin

l:=ord(s[2,i])+k;

if l=123 then

l:=l-26;

s4:=chr(l);

j:=ord(s[2,i])-k;

if j=123 then

j:=j-26;

s5:=chr(j);

for e:=0 to 6 do

if k=e then

begin

ss4[e]:=ss4[e]+s4;

ss5[e]:=ss5[e]+s5;

end;

end;

end;

for i:=0 to 6 do

begin

if (ss4[i]=s1) then

begin

if ss5[i]=s3 then

begin

b[2]:=true;

break;

end

else

b[2]:=false;

end

else

begin

if ss4[i]=s3 then

begin

if ss5[i]=s1 then

begin

b[2]:=true;

break;

end

else

b[2]:=false;

end

else

b[2]:=false;

end;

end;

for i:=0 to 6 do

begin

ss4[i]:='';

ss5[i]:='';

end;

for i:=1 to n do

begin

for k:=0 to 6 do

begin

l:=ord(s[3,i])+k;

if l=123 then

l:=l-26;

s4:=chr(l);

j:=ord(s[3,i])-k;

if j=123 then

j:=j-26;

s5:=chr(j);

for e:=0 to 6 do

if k=e then

begin

ss4[e]:=ss4[e]+s4;

ss5[e]:=ss5[e]+s5;

end;

end;

end;

for i:=0 to 6 do

begin

if (ss4[i]=s1) then

begin

if ss5[i]=s2 then

begin

b[3]:=true;

break;

end

else

b[3]:=false;

end

else

begin

if ss4[i]=s2 then

begin

if ss5[i]=s1 then

begin

b[3]:=true;

break;

end

else

b[3]:=false;

end

else

b[3]:=false;

end;

end;

t:=1;

for i:=1 to 3 do

if b[i] then

begin

t:=i;

break;

end;

for i:=1 to n do

s6:=s6+s[t,i];

writeln(s6);

close(input);

close(output);

end.

3 条评论

  • @ 2016-12-07 11:03:05

    渣渣

  • @ 2016-04-23 12:10:43

    太复杂了

  • @ 2012-08-08 18:07:42

    唉!

    program fdsg;

    var

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

    s1,s2,s3,ans:ansistring;

    s4,s:array[0..1000] of ansistring;

    a:array[1..26] of 'a'..'z';

    b:array['a'..'z'] of 1..26;

    ch:char;

    begin

    assign(input,'string.in');reset(input);

    assign(output,'string.out');rewrite(output);

    readln(n);

    s1:='';

    s2:='';

    s3:='';

    for i:=1 to 3 do

    readln(s[i]);

    k:=1;

    for ch:='a' to 'z' do

    begin

    a[k]:=ch;

    b[ch]:=k;

    inc(k);

    end;

    for i:=1 to 3 do

    begin

    s1:='';

    for j:=n downto 1 do

    begin

    ch:=s;

    s1:=s1+ch;

    end;

    for k:=0 to 6 do

    begin

    s2:=''; s3:='';

    for l:=1 to n do

    begin

    if b[s1[l]]+k>26 then s2:=s2+a[b[s1[l]]+k-26] else s2:=s2+a[b[s1[l]]+k];

    if b[s1[l]]-k

  • 1

信息

ID
1449
难度
6
分类
字符串 | 模拟 点击显示
标签
递交数
6972
已通过
1867
通过率
27%
被复制
9
上传者