Colouring tiles
Practice
0 (0 votes)
Dynamic programming
Problem
52% Success 178 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Alice’s bedroom has N tiles in a row and She wants to colour them using Red and Blue colour. So, there can be 2N patterns that she can get using these 2 colours. Out of those patterns, She doesn’t like those patterns in which any Four consecutive tiles are coloured red. You need to tell the number of different patterns that can be formed that Alice likes.

Note that each tile can be either coloured with a Red colour or a Blue colour.

INPUT:

First line contains T, the number of test cases.

Next T lines contain a single integer denoting N.

 

OUTPUT:

For each test case, Print the answer in a new line. Since the answer can be large, print it modulo 1000000007.

 

CONSTRAINTS:

1 <= T <= 105

1 <= N <= 106

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:20
Tags:
Easy
Points:20
1 votes
Tags:
Easy
Points:20
12 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsMathDynamic Programming
Editorial

No editorial available for this problem.