Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;
int main() {
FAST;
int tc = 1, ti;
cin >> tc;
for (ti = 1; ti <= tc; ++ti) {
int n, i, j, ans;
string s;
cin >> n >> s;
ans = 0;
for (i = 0; i < n; ++i) {
if (s[i] == '1') continue;
for (j = i+1; j < n; ++j) {
if (s[j] == '1') break;
}
ans = max(ans, j-i);
i = j-1;
}
cout << ans << "\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1113 Fliping Game
- Contest
- Brain Booster #7
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 14:45:50
- Judged At
- 2024-11-11 02:32:35
- Judged By
- Score
- 100
- Total Time
- 7ms
- Peak Memory
- 772.0 KiB