Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define int int64_t
- using namespace std;
- int mod = 1e9 + 7;
- int32_t main() {
- ios_base::sync_with_stdio(false);
- int n, k;
- cin >> n >> k;
- string s;
- cin >> s;
- vector<int> dp(n);
- dp[0] = 1;
- for (int i = 1; i < n; i++) {
- if (s[i - 1] == 'X') {
- continue;
- }
- for (int j = 1; j <= k && j <= i; j++) {
- (dp[i] += dp[i - j]) %= mod;
- }
- }
- cout << dp[n - 1] << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment