ac1173.pas
来自「同济大学 Online在线题库 AC源代码合集 程序设计竞赛必看资料」· PAS 代码 · 共 40 行
PAS
40 行
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 + =
减小字号Ctrl + -
显示快捷键?