主题:两个pascal竞赛题帮忙分析一下,先谢了!
program exam4;
var
n,i,t:longint;
tem:integer;
s:string;
begin
write('input n:');
readln(n);
s:='1';
[color=800000]repeat
i:=length(s);
while s[i]='1'do
begin
s[i]:='0';dec(i);
end;
if i>0 then s[i]:='1' else s:='1'+s;
val (s,t,tem);
until t mod n=0;
writeln(n,'*',t div n,'=',s);
end.[/color]
program cx20065;
function ack(m,n:integer):integer;
begin
if m=0 then ack:=n+1
else if n=0 then ack:=ack(m-1,1)
else ack:=ack(m-1,ack(m,n-1))
end;
begin
writeln(ack(2,2));
end.
哪位高手能帮忙分析一下这两个程序的运行过程,我有点看大不懂
var
n,i,t:longint;
tem:integer;
s:string;
begin
write('input n:');
readln(n);
s:='1';
[color=800000]repeat
i:=length(s);
while s[i]='1'do
begin
s[i]:='0';dec(i);
end;
if i>0 then s[i]:='1' else s:='1'+s;
val (s,t,tem);
until t mod n=0;
writeln(n,'*',t div n,'=',s);
end.[/color]
program cx20065;
function ack(m,n:integer):integer;
begin
if m=0 then ack:=n+1
else if n=0 then ack:=ack(m-1,1)
else ack:=ack(m-1,ack(m,n-1))
end;
begin
writeln(ack(2,2));
end.
哪位高手能帮忙分析一下这两个程序的运行过程,我有点看大不懂