每种状态的个数~
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 15, M = 1 << 12;
LL f[N][M], a, b;
bool vis[N];
int main()
{
while(cin >> a >> b)
{
if(a == 0) break;
for(int i = 0; i < 1 << a; i ++)
{
int cnt = 0;
vis[i] = true;
for(int j = 0; j < a; j ++)
{
if(i >> j & 1)
{
if(cnt & 1) vis[i] = false;
cnt = 0;
}
else cnt ++;
}
if (cnt & 1) vis[i] = false;
}
memset(f, 0, sizeof f);
f[0][0] = 1;
for(int i = 1; i <= b; i ++)
{
for(int j = 0; j < (1 << a); j ++)
{
for(int k = 0; k < (1 << a); k ++)
{
if((j & k) == 0 && vis[j | k])
{
f[i][j] += f[i - 1][k];
}
}
}
}
cout << f[b][0] << endl;
}
return 0;
}