CF1045H.Self-exploration
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Being bored of exploring the Moon over and over again Wall-B decided to explore something he is made of — binary numbers. He took a binary number and decided to count how many times different substrings of length two appeared. He stored those values in c00 , c01 , c10 and c11 , representing how many times substrings 00, 01, 10 and 11 appear in the number respectively. For example:
10111100→c00=1, c01=1, c10=2, c11=3
10000→c00=3, c01=0, c10=1, c11=0
10101001→c00=1, c01=3, c10=3, c11=0
1→c00=0, c01=0, c10=0, c11=0
Wall-B noticed that there can be multiple binary numbers satisfying the same c00 , c01 , c10 and c11 constraints. Because of that he wanted to count how many binary numbers satisfy the constraints cxy given the interval [A,B] . Unfortunately, his processing power wasn't strong enough to handle large intervals he was curious about. Can you help him? Since this number can be large print it modulo 109+7 .
输入格式
First two lines contain two positive binary numbers A and B ( 1≤A≤B<2100000 ), representing the start and the end of the interval respectively. Binary numbers A and B have no leading zeroes.
Next four lines contain decimal numbers c00 , c01 , c10 and c11 ( 0≤c00,c01,c10,c11≤100000 ) representing the count of two-digit substrings 00, 01, 10 and 11 respectively.
输出格式
Output one integer number representing how many binary numbers in the interval [A,B] satisfy the constraints mod 109+7 .
输入输出样例
输入#1
10 1001 0 0 1 1
输出#1
1
输入#2
10 10001 1 2 3 4
输出#2
0
说明/提示
Example 1: The binary numbers in the interval [10,1001] are 10,11,100,101,110,111,1000,1001 . Only number 110 satisfies the constraints: c00=0,c01=0,c10=1,c11=1 .
Example 2: No number in the interval satisfies the constraints