代码:
class Solution {
public int countGoodStrings(int low, int high, int zero, int one) {
long MOD = 1000000007;
int[] dp = new int[high+1];
dp[0]=1;
for(int i=1;i<=high;i++){
if(i-zero>=0){
dp[i] += dp[i-zero];
}
if(i-one>=0){
dp[i] +=dp[i-one];
}
dp[i]%=MOD;
}
long res = 0;
for(int i=low;i<=high;i++){
res += dp[i];
}
res%=MOD;
return (int)res;
}
}