From b7e55e6510690093d61f9cc1152e0330e55fe90b Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Tue, 28 Feb 2017 11:34:35 +0700 Subject: Update others/volume1 --- others/volume1/019.pas | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 others/volume1/019.pas (limited to 'others/volume1/019.pas') diff --git a/others/volume1/019.pas b/others/volume1/019.pas new file mode 100644 index 0000000..1c80fcc --- /dev/null +++ b/others/volume1/019.pas @@ -0,0 +1,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. -- cgit 1.4.1