📄 ac1173.pas
字号:
program tju1173;
const
maxtree=262143;
var
a:array[1..maxtree]of char;
k:longint;
c:char;
procedure cal(p,d:longint);
begin
if d=0 then
if a[p]='0' then a[p]:='A' else a[p]:='B'
else begin
cal(p-d,d shr 1);
cal(p+d,d shr 1);
if a[p-d]=a[p+d] then a[p]:=a[p-d] else a[p]:='C';
end;
end;
procedure out(p,d:longint);
begin
write(a[p]);
if a[p]='C' then begin
out(p-d,d shr 1);
out(p+d,d shr 1);
end;
end;
begin
repeat
k:=0;
repeat
inc(k);
read(c);
a[k*2-1]:=c;
until seekeoln;
readln;
cal(k,k shr 1);
out(k,k shr 1);
writeln;
until seekeof;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -