AcWing 3544. 寻找变化前的01序列

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
#include <iostream>
#include <string>
using namespace std;
int N;
string S;
int main() {
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> S;
int cnt = 0;
for (int i = 0; i < S.size(); ++i) {
if (S[i] == '1') {
++cnt;
} else {
int t = cnt;
cnt = 0;
if (t == 5) {
continue;
}
}
cout << S[i];
}
cout << endl;
}
return 0;
}