var
k,n:integer;
sum:real;
function Ak( x:integer):real; forward;
function Bk( y:integer):real;
begin
if y=1 then
Bk:=1
else
Bk:=2*sqr(Ak(y-1))+Bk(y-1);
end;
function Ak( x:integer):real;
if x=1 then
Ak:=1
Ak:=0.5*(sqrt((Bk(x-1))) + 0.5*(sqrt(Ak(x-1))));
readln(n); sum:=0;
for k:=1 to n do
sum:=sum+Ak(k)*Bk(k);
writeln('Sum: ',sum);
end.
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
var
k,n:integer;
sum:real;
function Ak( x:integer):real; forward;
function Bk( y:integer):real;
begin
if y=1 then
Bk:=1
else
Bk:=2*sqr(Ak(y-1))+Bk(y-1);
end;
function Ak( x:integer):real;
begin
if x=1 then
Ak:=1
else
Ak:=0.5*(sqrt((Bk(x-1))) + 0.5*(sqrt(Ak(x-1))));
end;
begin
readln(n); sum:=0;
for k:=1 to n do
sum:=sum+Ak(k)*Bk(k);
writeln('Sum: ',sum);
end.