poj3254
来源:互联网 发布:唯品会抢购软件 编辑:程序博客网 时间:2024/05/16 10:48
#include <iostream>#include <cstdio>#include <climits>#include <cstring>#include <cstdlib>using namespace std;int a[13],dp[13][4096],m,n,x;int maxn[13]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095};int main(){ int x; scanf("%d %d",&m,&n); memset(dp,0,sizeof(dp)); memset(a,0,sizeof(a)); for(int i=1;i<=m;++i) { a[i]=0; for(int j=1;j<=n;++j) { scanf("%d",&x); if(x==1) a[i]+=(1<<(j-1)); } } char str[50]; for(int i=0;i<=maxn[n];++i) { if((i|a[1])==a[1]) { if(((i<<1)&i)==0) dp[1][i]=1; } } for(int i=2;i<=m;++i) for(int j=0;j<=maxn[n];++j) { if((j|a[i])==a[i]) { if(((j<<1)&j)==0) for(int k=0;k<=maxn[n];++k) if(dp[i-1][k]>0) if((j&k)==0) dp[i][j]+=dp[i-1][k]; } } int ans=0; for(int i=0;i<=maxn[n];++i) { if(dp[m][i]!=0) ans+=dp[m][i]; } cout<<ans%100000000<<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
- 对博客的理解
- 500 error
- yii中的http访问
- 下拉框操作
- matlab实用程序(六)
- poj3254
- 6576
- 理解box-sizing属性border-box,content-box
- Kattis <Simon Says>
- 深入剖析装箱与拆箱机制
- stm32低功耗实验之待机模式
- 東京音頭 (东京音头) 歌词翻译
- JZOJ4779 【GDOI2017模拟9.14】鞍点(OICamp 2016 Day 5 T1) 计数问题
- 科普“智能导航”--整理自大疆工程师