http://acm.hdu.edu.cn/showproblem.php?pid=2604
由f、m组成长度为L的字符串的排列数,满足条件:不含fmf,fff的字串
///DP M<=30,想到打表,结果超了内存,
// 滚动数组过,开始用8个变量也超时了,那样太多复制操作了
#include <stdio.h>
int m,l;
int solve()
{
if(l == 1)
return 2 % m;
int ff[2],fm[2],mm[2],mf[2];
ff[0] = fm[0] = mm[0] = mf[0] = 1;
int p,c = 0;
for(int i = 3; i <= l; ++i)
{
c = (i&1);
p = 1 - c;
ff[c] = mf[p];
fm[c] = (mf[p] + ff[p]) % m;
mf[c] = mm[p];
mm[