POJ2411 Mondriaan's Dream
Description

Expert as he was in this material, he saw at a glance that he'll
need a computer to calculate the number of ways to fill the large
rectangle whose dimensions were integer values, as well. Help him, so
that his dream won't turn into a nightmare!
Input
input contains several test cases. Each test case is made up of two
integer numbers: the height h and the width w of the large rectangle.
Input is terminated by h=w=0. Otherwise, 1<=h,w<=11.
Output
Foreach test case, output the number of different ways the given rectangle
can be filled with small rectangles of size 2 times 1. Assume the given
large rectangle is oriented, i.e. count symmetrical tilings multiple
times.
Sample Input
1 2
1 3
1 4
2 2
2 3
2 4
2 11
4 11
0 0
Sample Output
1
0
1
2
3
5
144
51205
Source
//It is made by jump~
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const int MAXN = ;
const int MAXS = (<<);
int n,m;
LL f[][MAXS]; inline void solve(){
memset(f,,sizeof(f));
int end=(<<m)-; int tag=;
f[][end]=;//注意初值的设定!!!
for(int i=;i<n;i++)
for(int j=;j<m;j++){
tag^=; memset(f[tag],,sizeof(f[tag]));
for(int k=;k<=end;k++) {
if((k<<)&(<<m)) f[tag][(k<<)^(<<m)]+=f[tag^][k];//这一个格子不放
if(i && ( !((k<<)&(<<m)) )) f[tag][(k<<)^]+=f[tag^][k];//往上放
if(j && (!(k&)) && ((k<<)&(<<m))) f[tag][(k<<)^^(<<m)]+=f[tag^][k];//往左放
}
}
printf("%lld\n",f[tag][end]);
} inline void work(){
while() {
scanf("%d%d",&n,&m); if(n== && m==) break;
if((n*m)%==) { printf("0\n"); continue; }
if(n<m) swap(n,m);
solve();
}
} int main()
{
work();
return ;
}
POJ2411 Mondriaan's Dream的更多相关文章
- POJ2411 Mondriaan's Dream(状态压缩)
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 15295 Accepted: 882 ...
- poj2411 Mondriaan's Dream【状压DP】
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 20822 Accepted: 117 ...
- [Poj2411]Mondriaan's Dream(状压dp)(插头dp)
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 18096 Accepted: 103 ...
- POJ1185 炮兵阵地 和 POJ2411 Mondriaan's Dream
炮兵阵地 Language:Default 炮兵阵地 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 34008 Accepted ...
- poj2411 Mondriaan's Dream (轮廓线dp、状压dp)
Mondriaan's Dream Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 17203 Accepted: 991 ...
- [poj2411] Mondriaan's Dream (状压DP)
状压DP Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One nigh ...
- poj2411 Mondriaan's Dream (用1*2的矩形铺)
Description Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, af ...
- POJ2411 Mondriaan's Dream 轮廓线dp
第一道轮廓线dp,因为不会轮廓线dp我们在南京区域赛的时候没有拿到银,可见知识点的欠缺是我薄弱的环节. 题目就是要你用1*2的多米诺骨排填充一个大小n*m(n,m<=11)的棋盘,问填满它有多少 ...
- POJ2411 - Mondriaan's Dream(状态压缩DP)
题目大意 给定一个N*M大小的地板,要求你用1*2大小的砖块把地板铺满,问你有多少种方案? 题解 刚开始时看的是挑战程序设计竞赛上的关于铺砖块问题的讲解,研究一两天楞是没明白它代码是怎么写的,智商捉急 ...
随机推荐
- java 12-4 StringBuffer类的替换、反转、截取功能
1.StringBuffer的替换功能: public StringBuffer replace(int start,int end,String str):从start开始到end用str替换 pu ...
- 【转】使用sklearn做单机特征工程
这里是原文 说明:这是我用Markdown编辑的第一篇随笔 目录 1 特征工程是什么? 2 数据预处理 2.1 无量纲化 2.1.1 标准化 2.1.2 区间缩放法 2.1.3 无量纲化与正则化的区别 ...
- Linux第十一次学习笔记
异常控制流 异常控制流(ECF)发生在计算机系统的各个层次 在硬件层,硬件检测到的事件会触发控制突然转移到异常处理程序. 在操作系统层,内核通过上下文转换将控制从一个用户进程转移到另一个用户进程. 在 ...
- C#出题库项目的总结(2)
前记:好吧好吧,我好好的自我检讨,这个总结拖了这么久才来写,而且一周多没有看技术相关的东西,实在罪过,不过因为想做的事情太多,所以时间的分配确实是一个很严肃的问题,不是时间不够用,是我自己没有做好时间 ...
- IT男的”幸福”生活"续5
各位哥们姐妹们,好,嗯,好.很多回复还是提到[IT男的”幸福”生活"]是小说来着剧情不真实,我还是免为其难的说一下吧.是真的回忆录,具体的事情都有.人也是真实的.在这里还是谢谢,这几天一直关 ...
- 第十一课:js操作选择器的通用函数
1.判断文档是否是XML文档 var isXML = function(elem){ var documentElement = elem && (elem.ownerDocument ...
- [设计模式] JavaScript 之 原型模式 : Object.create 与 prototype
原型模式说明 说明:使用原型实例来 拷贝 创建新的可定制的对象:新建的对象,不需要知道原对象创建的具体过程: 过程:Prototype => new ProtoExam => clone ...
- 第一章 : javaScript框架分类及主要功能
从内部架构和理念划分,目前JavaScript框架可以划分为5类. 第一种是以命名空间为导向的类库或框架,如果创建一个数组用new Array(),生成一个对象用new Object(),完全的j ...
- DELETE和DELETE FROM有什么区别
你如果只针对表进行删除,则一样. 但是如果需要联合其他表,则需要使用from 例如 delete tb1 from tb1 m where id in (select id from tb2) 我的习 ...
- Pro Git 读书笔记
一. 起步 1. 集中式版本控制缺点:中央服务器的单点故障. 分布式版本控制优点:客户端并不只提取最新版本的文件快照,而是把代码仓库完整地镜像下来. 这么一来,任何一处协同工作用的服务器发生故障,事后 ...