?? ac1159.pas
字號:
program tju1159;
const
maxparts=8;
maxdigits=12;
var
p:array[0..maxparts]of byte;
d:array[1..maxdigits]of byte;
n,count:longint;
procedure search(l,x,d0:byte);
var
i,t,d1:byte;
function check:boolean;
var
pd,pp,x,e,y:word;
begin
pp:=0;x:=0;e:=1;
for pd:=1 to d1 do begin
inc(x,e*d[pd]);
if x*2>p[pp] then begin
dec(x,e*d[pd]);inc(pp);
if x<>p[pp] then begin check:=false;exit;end;
x:=d[pd];e:=1;
y:=pd-1;while d[y]=0 do begin x:=x*10;e:=e*10;dec(y);end;
end;
e:=e*10;
end;
check:=x=p[pp+1];
end;
begin
if x=0 then exit;
for i:=1 to x shr 1 do begin
p[l]:=i;
t:=i;d1:=d0;
repeat
inc(d1);d[d1]:=t mod 10;t:=t div 10;
until t=0;
if check then inc(count);
search(l+1,i,d1);
end;
end;
begin
repeat
read(n);
p[0]:=n;
count:=1;
search(1,n,0);
writeln(count);
until seekeof;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -