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

each 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大小的砖块把地板铺满,问你有多少种方案? 题解 刚开始时看的是挑战程序设计竞赛上的关于铺砖块问题的讲解,研究一两天楞是没明白它代码是怎么写的,智商捉急 ...
随机推荐
- 第11章 Windows线程池(1)_传统的Windows线程池
第11章 Windows线程池 11.1 传统的Windows线程池及API (1)线程池中的几种底层线程 ①可变数量的长任务线程:WT_EXECUTELONGFUNCTION ②Timer线程:调用 ...
- c#中结构体(struct)和类(class)的区别
一.类与结构的示例比较: 结构示例: public struct Person { string Name; int height; int weight public bool overWeight ...
- 谈谈redis主从复制的重点
Redis主从复制的配置十分简单,它可以使从服务器是主服务器的完全拷贝.下面是关于Redis主从复制的几点重要内容: Redis使用异步复制.但从Redis 2.8开始,从服务器会周期性的应答从复制流 ...
- css常用中文字体的英文名称写法
我们知道网页中使用中文字体最好用其对应的英文名称,这样可以避免出现编码问题导致样式中的中文名称出现乱码,从而不识别.下面是网页中常用的中文字体所对应的英文名称.留着,不用翻资料了 中文 英文 宋体 S ...
- mybatis-config.xml详解
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC ...
- Xcode7创建的项目添加启动图有问题?
在Xcode7下创建的项目,由于某个原因,Xcode7添加启动图有点不一样.Xcode7与Xcode6不一样的地方在于:Xcode6的LaunchScreen.xib改成了LaunchScreen.s ...
- Python基础 - 获取N天前的日期
获取今天前第N天的日期 from datetime import datetime from datetime import timedelta def get_date(days=N): retur ...
- Oracle 组织架构(转)
原文地址:Oracle 组织架构 我们先来看一下实际生活中的集团组织架构. 下图是一个典型的投资集团组织架构. 集团在各个国家有独立的法人. 每个法人会负责若干个业务进行,比如石油开采,汽车制造,软件 ...
- 如何“刷leetcode”
做题目的: 获得 offer 巩固算法与数据结构知识,将学到的东西用出来 如何做题: 根据章节与难度来做. 比如你学了 linked list,就去找到标签为 linked list 的题目,然后根据 ...
- IBatis.Net学习笔记六--再谈查询
在IBatis.Net学习笔记五--常用的查询方式 中我提到了一些IBatis.Net中的查询,特别是配置文件的写法. 后来通过大家的讨论,特别是Anders Cui 的提醒,又发现了其他的多表查询的 ...