diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-28 11:34:35 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2017-02-28 11:34:35 +0700 |
commit | b7e55e6510690093d61f9cc1152e0330e55fe90b (patch) | |
tree | 36b48f77d96adaaaefc7728c8a95ca5d4342d653 /others/volume1/019.pas | |
parent | 7ebfa64719d4ac86b30075c65f21eafe9097853e (diff) | |
download | cp-b7e55e6510690093d61f9cc1152e0330e55fe90b.tar.gz |
Update others/volume1
Diffstat (limited to 'others/volume1/019.pas')
-rw-r--r-- | others/volume1/019.pas | 21 |
1 files changed, 21 insertions, 0 deletions
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. |