题目链接

 #include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
using namespace std;
typedef long long ll; inline int read()
{
int x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
} /********************************************************************/ const int mod = ;
const int maxn = ;
int n, m;
int dp[][(<<)+];
int a[maxn]; int line(int x, int y){
if((a[x]&y) != y) return ;
if((y&(y<<)) != ) return ;
return ;
} int main(){
int n,m;
while(~scanf("%d%d",&n,&m)){
for(int i=;i<=n;i++){
a[i]=;
for(int j=;j<=m;j++){
int t;
scanf("%d",&t);
a[i]=(a[i]<<)+t;
}
}
memset(dp,,sizeof(dp));
dp[][] = ;
for(int i = ;i <= n;i++){
for(int j=;j<(<<m);j++){
if(line(i,j)==)continue;
for(int k=;k<(<<m);k++){
if((j&k)==){
dp[i][j]=dp[i][j]+dp[i-][k];
dp[i][j]%=mod;
}
}
}
}
int ans = ;
for(int i = ;i < (<<m);i++){
ans= (ans + dp[n][i] )%mod;
}
printf("%d\n",ans);
}
}

Corn Fields(模板)的更多相关文章

  1. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  2. 【BZOJ1725】[Usaco2006 Nov]Corn Fields牧场的安排 状压DP

    [BZOJ1725][Usaco2006 Nov]Corn Fields牧场的安排 Description Farmer John新买了一块长方形的牧场,这块牧场被划分成M列N行(1<=M< ...

  3. poj 3254 Corn Fields

    http://poj.org/problem?id=3254 Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...

  4. Corn Fields——POJ3254状态压缩Dp

    Corn Fields Time Limit: 2000MS Memory Limit: 65536K Description Farmer John has purchased a lush new ...

  5. poj3254 Corn Fields (状压DP)

    http://poj.org/problem?id=3254 Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...

  6. POJ 3254 Corn Fields(状态压缩DP)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4739   Accepted: 2506 Descr ...

  7. 状压DP POJ 3254 Corn Fields

    题目传送门 /* 状态压缩DP:先处理硬性条件即不能种植的,然后处理左右不相邻的, 接着就是相邻两行查询所有可行的种数并累加 写错一个地方差错N久:) 详细解释:http://www.tuicool. ...

  8. POJ 3254 Corn Fields(状压DP)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13732   Accepted: 7216 Desc ...

  9. BZOJ1725: [Usaco2006 Nov]Corn Fields牧场的安排

    1725: [Usaco2006 Nov]Corn Fields牧场的安排 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 400  Solved: 290 ...

随机推荐

  1. 右上角鼠标滑过展开收缩动画效果js代码的演示页面

    http://files.cnblogs.com/files/tanlingdangan/top_right.rar.gz 右上角鼠标滑过展开收缩动画效果js代码的演示页面http://www.51x ...

  2. js/html/css做一个简单的图片自动(auto)轮播效果//带注释

    FF(firefox)/chrom/ie稳定暂无bug...注意:请自己建立一个images文件,放入几张900*238的图片(注意图片格式和名字与程序中一致). 1. [图片] 1.JPG 2. [ ...

  3. html5基本格式

    html5基本格式 学习要点: HTML5 文档的基本格式 2. 开发工具的基本操作 一.  文档基本格式 <!DOCTYPE  html>  文档声明,告诉计算机这是一个HTML5文档. ...

  4. Early Media and Music on Hold

    Early media refers to any media that is played to the initial caller’s phone before the remote party ...

  5. python打印字体颜色

        格式:\033[显示方式;前景色;背景色m 显示方式           意义-------------------------0                终端默认设置1         ...

  6. 基于bootsplash的嵌入式linux启动画面定制

    来源: ChinaUnix博客 作者: ChinaUnix博客 发布时间:2007-01-01 16:29:00 摘 要:在基于linux的嵌入式仿真平台研发中,利用开源工具bootsplash能够定 ...

  7. poj1050最大矩阵和——暴力枚举

    题目:http://poj.org/problem?id=1050 s[i][j]数组记录以点(i,j)为右下角.(1,1)为左上角的子矩阵内部和: 枚举子矩阵左上角和右下角,取最大值即可. 代码如下 ...

  8. SIP业务基本知识

    1.SIP业务基本知识 1.1 业务介绍会话初始协议(Session Initiation Protocol)是一种信令协议,用于初始.管理和终止网络中的语音和视频会话,具体地说就是用来生成.修改和终 ...

  9. lwip 分析一

    一.接收端 1.通过ehternetif_input void ethernetif_input(struct netif *netif) {   struct ethernetif *etherne ...

  10. 第一章 Git 一览

    虽然这个系列的文章主要关注的是Github,然而首先了解下Git的基本概念和名词也是非常有帮助的. 工作目录(Working Directory) 工作目录是你个人计算机上的一个目录.在该目录下,每一 ...