All submissions for this problem are available.
Round a number to the closest whole integer in the Fibonacci sequence. If two elements in the sequence are equally far away, round up. The sequence should start from 0. (eg 0, 1, 1, 2, 3, 5, 8, 13.....).
The only line in the input consists of a positive integer N (1<=N<=100000).
The output is the closest number from the Fibonacci series. In case the input is already in the Fibonacci series, print the same number.
Input: 4 Output: 5.
|Time Limit:||0.1 - 0.13834 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.