Tiling_easy versionTime
limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 5516 Accepted Submission (s): 4347
Problem description has a grid size of 2 x N and now requires 2 sizes of dominoes to be paved, and the domino specifications are 2 x 1 and 2 x 2, please calculate how many kinds of paving methods there are.
The first line of input inputs contains a positive integer t (t<=20), representing a total of T-group data, followed by a T-row of data, each containing a positive integer n (n<=30), indicating that the size of the grid is 2 rows N columns.
The output output has a total number of paving methods, one row for each set of data.
Sample Input
32812
Sample Output
31712731
Source "ACM Program Design" Short Semester exam _ software engineering and other major
idea: recursion, formula for a[n] = a[n-1] + 2*a[n-2];
AC Code:
Hdu-2501-tiling_easy version (simple recursive relationship!!) )