棋盘式dp模板
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
const int N = 15, M = 1 << N;
typedef long long LL;
LL f[N][M];
int a, b;
bool st[M];
int main(){
while(cin >> a >> b, a | b){
for(int i = 0; i < (1 << a); i ++){
st[i] = true;
int cnt = 0;
for(int j = 0; j < a; j ++){
if(i >> j & 1)
if(cnt & 1){
st[i] = false;
break;
}
else cnt = 0;
else cnt ++;
}
if(cnt & 1)st[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(st[k | j] && (k & j) == 0)
f[i][j] += f[i - 1][k];
}
}
printf("%lld\n", f[b][0]);
}
return 0;
}