-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1506B.cpp
More file actions
44 lines (37 loc) · 730 Bytes
/
Copy path1506B.cpp
File metadata and controls
44 lines (37 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
cin.tie(0);
ios::sync_with_stdio(0);
int t;
cin >> t;
while (t--)
{
int n, k;
cin >> n >> k;
string s;
cin >> s;
int count = 0;
int i = 0;
while (i < n && s[i] != '*')
i++;
count++;
while (true)
{
int pos = -1;
for (int j = i + 1; j <= i + k && j < n; j++)
{
if (s[j] == '*')
pos = j;
}
if (pos == -1)
break;
count++;
i = pos;
}
cout << count << "\n";
}
return 0;
}