C语言的编程的技术,去解决这里二进制的序列的一个问题的算法怎么实现的思路

Problem Description
Nanjing University of Science and Technology is celebrating its 60th anniversary. In order to make room for student activities, to make the university a more pleasant place for learning, and to beautify the campus, the college administrator decided to start construction on an open space.
The designers measured the open space and come to a conclusion that the open space is a rectangle with a length of n meters and a width of m meters. Then they split the open space into n x m squares. To make it more beautiful, the designer decides to cover the open space with 1 x 1 bricks and 1 x 2 bricks, according to the following rules:

  1. All the bricks can be placed horizontally or vertically
  2. The vertexes of the bricks should be placed on integer lattice points
  3. The number of 1 x 1 bricks shouldn’t be less than C or more than D. The number of 1 x 2 bricks is unlimited.
  4. Some squares have a flowerbed on it, so it should not be covered by any brick. (We use 0 to represent a square with flowerbet and 1 to represent other squares)

Now the designers want to know how many ways are there to cover the open space, meeting the above requirements.

Input
There are several test cases, please process till EOF.
Each test case starts with a line containing four integers N(1 <= N <= 100), M(1 <= M <= 10), C, D(1 <= C <= D <= 20). Then following N lines, each being a string with the length of M. The string consists of ‘0’ and ‘1’ only, where ‘0’ means the square should not be covered by any brick, and ‘1’ otherwise.

Output
Please print one line per test case. Each line should contain an integers representing the answer to the problem (mod 109 + 7).

Sample Input
1 1 0 0
1
1 1 1 2
0
1 1 1 2
1
1 2 1 2
11
1 2 0 2
01
1 2 0 2
11
2 2 0 0
10
10
2 2 0 0
01
10
2 2 0 0
11
11
4 5 3 5
11111
11011
10101
11111

Sample Output
0
0
1
1
1
2
1
0
2
954

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
一个未知的二进制文件,不知道编码格式如何解析,文件后缀名为 ".mlx"
4
CRC校验代码看不懂,请求高手支招。目前我看不懂的一篇CRC校验文章和一套逆序CRC校验。
3
C++中使用二进制文件保存和读取结构体的问题
0
netty基于http协议实现二进制文件和文本文件的传输;
5
C++ 数据转换 如何将文本文件(.txt)转换成二进制文件(.dat)?
6
c++针对二进制补码算术中整数的算术运算问题,请大神指点
2
json文件中的内容转成二进制流存储到另一个txt文件中,并且可以逆向
3
c++中用openCV的IplImage*或Mat读取图片后如何转化为File文件流(或者二进制数据)的格式
3
求助,本人小白;用C语言怎么用2种不同思路输出OXE3的二进制?
2
java上传文件时,前台的如何把文件以二进制的方式传到后台
1
C语言写入数据到二进制文件失败
2
C语言输出格雷码的问题
3
python3 图片的二进制流转图片的方法
2
C# 读取C++写的 二进制文件
1
C语言求问这个二进制转换的问题怎么计算,要用到图的知识
2
这个问题,,用C语言解决,计算二进制的位数的问题,很难
1
一个有关二进制数字的输出的问题, 用C语言的输出,怎么实现的?
0
对一个整数做二进制位操作的一个题目,怎么采用C 语言的方式的实现
0
最大二进制公共子序列的一个算法的问题如何利用C语言的办法去实现怎么做?
0
一个字符串基于base64方式实现的编码算法,用二进制的表达,采用C语言实现