Corn Fields
Description 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 34 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.
题意:在给出一片地有肥沃的地有贫瘠的地只能在肥沃的地里放牛并且相邻两块肥沃的土地不能同时放牛问有多少种放牛方案状压dp
|
详细解决方案
POJ3254Corn Fields【状压dp】
热度:39 发布时间:2023-12-17 08:48:00.0
相关解决方案
- 为啥数据库中【价格】字段(文本型)是空的,ISNULL(rs.fields("价格"))的结果却是FALSE
- rs.Fields.Append "oneStar" 200, 50 是价格类型?如何装成数字类型
- <img src="image/<%rs.fields(0).value%>gif">为什么不对
- this.ds.fields.get(.).name替空或不是对象
- this.fields.get(.).sortType
- running total fields,该怎么解决
- FieldS "F_REFNUM"reference column REF at a frequence below its group,该如何处理
- [OpenPose翻译] Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields ?原文翻译(注释版)
- Serializer fields - Django REST framework
- poj 3254 Corn Fields (状压dp)(棋盘dp)
- Both 'fieldsets' and 'fields' are specified.
- spring cron expression must consist of 6 fields 已解决,亲测有效
- 【POJ - 3254】Corn Fields 【状压DP】
- 【Codeforces Round#621 (Div. 1 + Div. 2)】D. Cow and Fields 题解
- Gson对象转json时有个坑 IllegalArgumentException declares multiple JSON fields named
- 好题分析:状态压缩dp入门--Poj - 3254 Corn Fields
- POJ - 3254 Corn Fields ( 状态压缩 DP )
- 二分图最小点覆盖 POJ1325 Machine Schedule POJ2226 Muddy Fields
- Gson转换实体类为json时报declares multiple JSON fields named
- poj 2226 Muddy Fields
- 洛谷1879 [USACO06NOV]玉米田Corn Fields
- POJ 2226 Muddy Fields(最小点覆盖)
- POJ 2226 Muddy Fields(算法竞赛进阶指南,二分图最小点覆盖)
- svn Unexpected HTTP status 431 ‘Request Header Fields Too Large‘ on
- No module named 'captcha.fields' , django 报错
- 解决mongoengine报错mongoengine.errors.FieldDoesNotExist: The fields xxx
- 洛谷 P1879——[USACO06NOV]玉米田Corn Fields【状压DP】
- POJ3254Corn Fields【状压dp】
- Elasticsearch5.X进行聚合操作时提示Fielddata is disabled on text fields by default
- Elasticsearch.Net 异常:[match] query doesn‘t support multiple fields, found [field] and [query]