John and the Ladder of Odds
Practice
0 (0 votes)
Medium
Linear algebra
Matrix exponentiation
Algorithms
Mathematics
Open
Approved
Problem
22% Success 622 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

This weekend John is headed to visit the new fun city in town. A very popular game is called the "Ladder of odds".

In this game, you have to climb up the ladder of height h, using only odd number of steps. But you don't progress to the next level unless you climb down as well..!!!

For example: If we have a ladder of height 4 we can go up in 3 ways (1 + 1 + 1 + 1, 3 + 1, 1 + 3) .

Being the curious kid that John is, he would like to know the total number of ways to do so.

Moreover, the entire place contains these game ladders of varying heights up to N.

So, the 1st game has h = 1, the 2nd game has h = 2, and so on upto the Nth game.

Determine the summation of number of ways to complete each game if a new game can only be started after completion of previous game.

Input:

The first line contains number of test cases, T. Each of the following T lines contain an integer N, as defined above.

Output:

Each line of output should contain exactly one number indicating answer of corresponding test case. Output may be too large so print it modulo 10^9+9.

Constraints:

1 <= T <= 100000
1 <= N <= 1015

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
Linear AlgebraDynamic ProgrammingMatrix ExponentiationMediumMathematics
Points:30
4 votes
Tags:
MediumLinear AlgebraMatrix ExponentiationAlgorithmsMathematicsOpenApproved
Points:30
1 votes
Tags:
MediumLinear AlgebraMatrix ExponentiationBitmaskAlgorithmsMathematicsOpenApproved