about summary refs log tree commit diff
path: root/others/volume1/019.pas
blob: 1c80fcc399de12adcf35f2ff1acd043b43f74084 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
uses clib;

var
  a: intar;
  i: int8;
  n, m: int64;

begin
  readln(n);
  setlength(a, 87);
  for i := 2 to 88 do
    a[i - 1] := fibonacci[i];
  while n > 0 do
    begin
      m := bisect_left(a, n);
      if a[m] > n then
        m := m - 1;
      writeln(a[m]);
      n := n - a[m]
    end
end.