Fibonacci Numbers
Practice
3.3 (3 votes)
Easy
Problem
41% Success 2357 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Find summation of Fibonacci numbers from l to r mod 99991. Precisely find (fib(l) + fib(l+1) + ..... + fib(r) ) mod 99991.
Initial conditions for Fibonacci numbers is defined as follows :
fib(0) = 0 , fib(1) = 1
Input Format
Input contains a single line containing two space separated integers l and r.
Output Format
Output single integer denoting the answer.
Constraints :
0<=l<=r<=10^18
Setter : Aayush Kapadia
Sample Input
1 4
Sample Output
7
Explanation
fib[1] + fib[2] + fib[3] + fib[4] = 1 + 1 + 2 + 3 = 7.
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:20
1 votes
Tags:
Easy
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor