Submit | All submissions | Best solutions | Back to list |
MNTILE - Tiling a WxH Grid With Dominoes |
Write a program that takes as input the width, W and height H of the grid and outputs the number of different ways to tile a W-by-H grid with (2x1) dominoes.
Score is the length of your source.
Input
The first line is an integer T(1 ≤ T ≤ 276), denoting the number of test cases. Then, T test cases follow.
For each test case, there are two integers W and H(0 ≤ W+H ≤ 22) written in one line, separated by space.
Output
For each test case, output the number of different ways to tile a W-by-H grid with (2x1) dominoes.
Example
Input: 6
1 2
2 3
3 4
4 5
5 6
6 7 Output:
1
3
11
95
1183
31529
Information
All outputs will fit on 64-bit signed integer and less than 1015.
You may try M3TILE, M4TILE, or M5TILE first.
Added by: | Tjandra Satria Gunawan |
Date: | 2012-07-02 |
Time limit: | 1s |
Source limit: | 300B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32-GCC ASM64 MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST SCM qobi CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |
Resource: | Generalization of M3TILE, M4TILE/GNY07H, and M5TILE problems. |