题目大意:2xN放2x1和2x2的方块多少种放法。
分析:a[n]=a[n-1]+a[n-2]*2
2xN相当于2x(n-1)加一个竖着的方块,和2x(n-2)加两个竖着的,两个横着的,一个大方块,其中放两个竖着的重复。
代码:
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
string s[255];
string add(string x, string y)
{
if (x.length() < y.length())
swap(x, y);
int i, j;
for (i = x.length() - 1, j = y.length()