Once upon a time in the quaint village of Turlington, there lived a talented artisan named Ella. Ella had a unique skill – she could transform any floor into a mesmerizing mosaic using special tiles. These magical tiles were of size , and Ella's artistic flair knew no bounds.
One day, the villagers gathered around Ella's workshop, curious about the secrets behind her enchanting tile arrangements. Ella, always happy to share her knowledge, decided to turn this curiosity into a challenge. She introduced the villagers to a puzzle: The problem of finding the absolute difference between the number of ways and the number of ways to tile a floor of size . The twist in the tale was that the tiles could be rotated in any direction, meaning a tile could also become an tile.
The villagers, eager to test their problem-solving skills, embarked on a series of queries. In each query, they provided two numbers, and , representing the dimensions of the floor and the magical tiles, respectively. Ella emphasized that the answers should be calculated modulo since the answer can be very large.
Distinct Ways:
Distinct Ordered Ways:
Input format
Output format
Constraints
For the query :
N = 6 and X = 4
Number of distinct ways = 4
No of distinct ordered ways = 2 (because 2nd ,3rd and 4th are considered as same arrangement)
So, the answer is absolute(4 - 2) = 2.