【OpenJudge|【OpenJudge 1665】完美覆盖
http://noi.openjudge.cn/ch0405/1665/?lang=zh_CN
状压水题,手动转移
#include
#include
#include
using namespace std;
int in() {
int k = 0, fh = 1;
char c = getchar();
for(;
c < '0' || c > '9';
c = getchar())
if (c == '-') fh = -1;
for(;
c >= '0' && c <= '9';
c = getchar())
k = k * 10 + c - 48;
return k * fh;
}int f[103][8], n;
int main() {
f[0][7] = 1;
for(int i = 1;
i <= 30;
++i) {
f[i][1] = f[i - 1][6];
f[i][2] = f[i - 1][5];
f[i][3] = f[i - 1][4] + f[i - 1][7];
f[i][4] = f[i - 1][3];
f[i][5] = f[i - 1][2];
f[i][6] = f[i - 1][1] + f[i - 1][7];
f[i][7] = f[i - 1][3] + f[i - 1][6] + f[i - 2][7];
}
while ((n = in()) != -1)
printf("%d\n", f[n][7]);
return 0;
}
【【OpenJudge|【OpenJudge 1665】完美覆盖】转载于:https://www.cnblogs.com/abclzr/p/5957990.html
推荐阅读
- 宽容谁
- 我要做大厨
- 增长黑客的海盗法则
- 画画吗()
- 2019-02-13——今天谈梦想()
- 远去的风筝
- 三十年后的广场舞大爷
- 叙述作文
- 20190302|20190302 复盘翻盘
- 学无止境,人生还很长