poj3254
来源:互联网 发布:鲁尼植发价格 知乎 编辑:程序博客网 时间:2024/04/29 11:00
#include <iostream>#include<cstdio>#include<cmath>#include<string>#include<cstring>#include<algorithm>using namespace std;const int maxn=13;const int inf = 0x3f3f3f3f;const int mod=1e8;bool cant[(1<<maxn)]={0};int f[maxn][(1<<maxn)]={0};int main(){ int m,n; cin>>m>>n; int maxs=(1<<n); int a[maxn]={0}; for(int i=0;i<maxs;i++) if(i&(i>>1)) cant[i]=true; for(int i=0;i<m;i++) for(int j=0;j<n;j++) { int x; cin>>x; if(x==0) a[i]=a[i]^(1<<j); } for(int j=0;j<maxs;j++) f[0][j]=(cant[j] || (a[0]&j))?0:1; for(int i=1;i<m;i++) { for(int j=0;j<maxs;j++) { if(cant[j] || (a[i]&j)) continue; for(int k=0;k<maxs;k++) { if(cant[k] || j&k) continue; f[i][j]=(f[i][j]+f[i-1][k])%mod; } } } int ans=0; for(int j=0;j<maxs;j++) ans=(ans+f[m-1][j])%mod; cout<<ans<<endl; return 0;}
0 0
- POJ3254
- poj3254
- poj3254
- POJ3254
- poj3254
- POJ3254
- poj3254
- POJ3254
- poj3254
- poj3254
- POJ3254
- Poj3254 状态压缩DP
- 【DP】 poj3254 Corn Fields
- DP poj3254 Corn Fields
- poj3254 状态压缩dp
- poj3254 Corn Fields
- POJ3254--Corn Fields
- poj3254 Corn Fields
- IOS OC声明变量在@interface括号中与使用@property的区别
- H5截取当前网页
- 工作
- LINUX系统中动态链接库的创建与使用
- ffmpeg的转码延时测试与设置优化
- poj3254
- 使用Python控制IE访问网站
- 数组中出现次数超过一半的数字
- 欧几里德算法的证明
- XML小项目------dom4j操作联系人(图形界面版)
- Spring mvc整合freemarker详解
- Gh0st控制端远程堆溢出
- 多个fragment切换,而不重新加载数据的实现
- 4-9 二叉树的遍历 (25分)