Задача E. Не упадѐт!

Anonymous     Pascal/Delphi     28 Oct 2012    
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// http://vk.com/photo28420405_290764079
var
n: longword; //Высота
a: array[1..1000] of longword;
m: integer;
function Fib(x: longword): longword;
begin
if (a[x] = 0) then
a[x] := Fib(x - 1) + Fib(x - 2);
Result := a[x];
end;
begin
a[1] := 2; a[2] := 3;
ReadLn(n); WriteLn(Fib(n));
end.