Description
In how many ways can you tile a 3xn rectangle with 2x1 dominoes?
Here is a sample tiling of a 3x12 rectangle.
Input
Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 <= n <= 30.
Output
For each test case, output one integer number giving the number of possible tilings.
Sample Input
2812-1
Sample Output
31532131
题解
看了别人的博客都是递推啥的,
之前自己推了半天推不出来,智商捉鸡,就放着没做了
直到我做了POJ 2411后
再回来看这题,就是把宽度设为3而已...
#include #include //EOF,NULL#include //memset#include //ceil,floor,exp,log(e),log10(10),hypot(sqrt(x^2+y^2)),cbrt(sqrt(x^2+y^2+z^2))#include //fill,reverse,next_permutation,__gcd,#include #include #include #include #include