MetaOA #27
Closest Land Mark
估计简单可在线判题
考点(AI 标注)位运算
The Fibonacci numbers start from 0 and 1, and each later term is the sum of the previous two. Given a non-negative integer N, output the absolute difference to the nearest Fibonacci number; output only the distance, not the number itself.
输入格式
One line with N (0..1000000).
输出格式
Output the minimum absolute difference.
样例 1
输入:
25
输出:
4
样例 2
输入:
5
输出:
0
样例 3
输入:
0
输出:
0
样例说明
Example 1: 25 lies between 21 and 34, at distances 4 and 9 respectively, so the answer is 4.
Example 2: 5 is itself a Fibonacci number, so the distance is 0.
Example 3: 0 is the first term of the sequence, so the distance is 0.