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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.