Code
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
string s1 = "";
for (char c : s) {
if (c == '0') {
s1 += '1';
} else {
s1 += '0';
}
}
int mx=0,cnt=1;
for(int i=0; i<s1.size(); i++){
if(s1[i]=='1' && s1[i+1]=='1'){
cnt++;
if(cnt>mx){
mx=cnt;
}
}
else cnt=1;
}
cout<<mx<<endl;
}
int main() {
int t;
cin >> t;
while (t--) solve();
return 0;
}
Information
- Submit By
- Type
- Pretest
- Problem
- P1113 Fliping Game
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-11-05 15:18:44
- Judged At
- 2024-11-11 02:30:58
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 316.0 KiB