Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, some of the squares are infertile and can't be planted. Canny FJ knows that the cows dislike eating close to each other, so when choosing which squares to plant, he avoids choosing squares that are adjacent; no two chosen squares share an edge. He has not yet made the final choice as to which squares to plant.

Being a very open-minded man, Farmer John wants to consider all possible options for how to choose the squares for planting. He is so open-minded that he considers choosing no squares as a valid option! Please help Farmer John determine the number of ways he can choose the squares to plant.

Input

Line 1: Two space-separated integers: M and N 
Lines 2.. M+1: Line i+1 describes row i of the pasture with N space-separated integers indicating whether a square is fertile (1 for fertile, 0 for infertile)

Output

Line 1: One integer: the number of ways that FJ can choose the squares modulo 100,000,000.

Sample Input

2 3
1 1 1
0 1 0

Sample Output

9

Hint

Number the squares as follows:

1 2 3  4  

There are four ways to plant only on one squares (1, 2, 3, or 4), three ways to plant on two squares (13, 14, or 34), 1 way to plant on three squares (134), and one way to plant on no squares. 4+3+1+1=9.

转载于:https://www.cnblogs.com/qldabiaoge/p/9345721.html

POJ3254Corn Fields 状压dp相关推荐

  1. POJ - 3254 Corn Fields(状压dp)

    题目链接:点击查看 题目大意:给出一个n*m的地图,有些位置不能放牧,然后放牧的条件是相邻两个格子不允许同时使用,问可行方案有几种 题目分析:因为给出的数据范围很小,并且放牧的状态是放或者不放,很容易 ...

  2. [USACO06NOV]玉米田Corn Fields (状压$dp$)

    题目链接 Solution 状压 \(dp\) . \(f[i][j][k]\) 代表前 \(i\) 列中 , 已经安置 \(j\) 块草皮,且最后一位状态为 \(k\) . 同时多记录一个每一列中的 ...

  3. poj3254 Corn Fields 状压DP入门

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 19368   Accepted: 10169 Des ...

  4. Poj - 3254 Corn Fields (状压DP)(入门)

    题目链接:https://vjudge.net/contest/224636#problem/G 转载于:https://blog.csdn.net/harrypoirot/article/detai ...

  5. 【每日DP】day2、P1879 [USACO06NOV]Corn Fields G玉米地(状压DP模板题)难度⭐⭐⭐★

    昨天的每日DP我还在写01背包,今天就到状压DP了,真刺激. P1879 [USACO06NOV]Corn Fields G 题目链接 输入 2 3 1 1 1 0 1 0 输出 9 一道简单的状压D ...

  6. 刷题周记(九)——#状压DP:最短Hamilton路径、小国王(互不侵犯)、玉米田(Corn Fields G)、愤怒的小鸟、吃奶酪、炮兵阵地、宝藏 #区间DP:清空字符串#DP:关灯问题II

    文章目录 --2020年12月20日(周日)------------------ 状压DP 一.最短Hamilton路径(模板题) 二.玉米田(P1879 [USACO06NOV]Corn Field ...

  7. 动态规划 —— 状压 DP

    [概述] 通常将以一个集合内的元素信息作为状态且状态总数为指数级别的动态规划称为状态压缩动态规划. 其是一类以集合信息为状态的特殊的动态规划问题,主要有传统集合动态规划与基于连通性状态压缩的动态规划两 ...

  8. POJ3254 状压DP模板

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 6321   Accepted: 3361 Descr ...

  9. 状压dp个人刷题记录

    目录 一.普通型 蒙德里安的梦想 题意: 思路: code: #2153. 「SCOI2005」互不侵犯 题意: 思路: code: P1879 [USACO06NOV]Corn Fields G 题 ...

最新文章

  1. 13、Excutors 结合 ThreadFactory 自动给线程加上线程名
  2. 中国无人车公司AutoX,打响加州RoboTaxi服务第一枪
  3. Sublime Text3中文环境设置
  4. Bailian2816 红与黑【DFS】
  5. java odbc timesten_TimesTen ODBC 链接库差异及相关命令行工具的使用注意事项
  6. 白话空间统计之:空间自相关
  7. 编译原理NFA确定化
  8. 百度地图API获取公交路线及站点数据
  9. 如何删除tmp计算机桌面,win10系统下tmp临时文件删除不了像何解决
  10. 计算机的6种典型应用领域,人工智能已经广泛应用到许多领域,其典型的应用包括这些...
  11. 内卷的国货彩妆下,完美日记还能“火”多久?
  12. 三维游戏开发实战--狙击僵尸(unity开发)
  13. 嵩天老师python123测验7: 文件和数据格式化 (第7周)
  14. 解决线程安全问题的两种办法
  15. 最新网站外链建设方法大全!
  16. 简单介绍区块链的联盟链
  17. tftp方式下载烧录镜像到目标机
  18. 微信打开网页提示有重定向,需点继续访问才能访问的解决方案
  19. css中各种代码的属性所表示的效果
  20. 简约好看的响应式Fly博客模板+Emlog内核/附安装文档

热门文章

  1. 深度学习之人脸检测实践-现有框架实现 opencv Face++
  2. VS2010下多线程的调试(来自MSDN)
  3. Eclipse 常用快捷键收集
  4. MATrICP论文解读
  5. leetcode - 139. 单词拆分
  6. leetcode - 494. 目标和
  7. leetcode - 764. 最大加号标志
  8. 包含目录、库目录、附加包含目录、附加库目录、附加依赖项如何使用? 及静态库,动态库的创建与调用和vs里引用的使用
  9. Photoshop cs6中kuler和mini bridge打开是空白的解决方法
  10. 使用ffmpeg捕获USB外部摄像头视频流