2 by n Tiling 2
InterviewTime limit1sMemory limit256 MB
Count the ways to tile a 2 by n rectangle with dominoes and 2 by 2 squares, modulo 10007.
- Level
Easy3 of 10
- Topics
- Dynamic programming
- Solved
- No attempts yet
Problem
Write a program that counts the ways to fill a rectangle with , , and tiles. Tiles must not overlap, must not stick out of the rectangle, and must leave no empty cell.
Two fillings are different if any tile sits in a different place.
Input
The first line contains . ()
Output
Print the number of ways to fill the rectangle, modulo , on the first line.