CF946F.Fibonacci String Subsequences
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a binary string s (each character of this string is either 0 or 1).
Let's denote the cost of string t as the number of occurences of s in t . For example, if s is 11 and t is 111011, then the cost of t is 3 .
Let's also denote the Fibonacci strings sequence as follows:
- F(0) is 0;
- F(1) is 1;
- F(i)=F(i−1)+F(i−2) if i>1 , where + means the concatenation of two strings.
Your task is to calculate the sum of costs of all subsequences of the string F(x) . Since answer may be large, calculate it modulo 109+7 .
输入格式
The first line contains two integers n and x ( 1<=n<=100 , 0<=x<=100 ) — the length of s and the index of a Fibonacci string you are interested in, respectively.
The second line contains s — a string consisting of n characters. Each of these characters is either 0 or 1.
输出格式
Print the only integer — the sum of costs of all subsequences of the string F(x) , taken modulo 109+7 .
输入输出样例
输入#1
2 4 11
输出#1
14
输入#2
10 100 1010101010
输出#2
553403224