Accepted
Code
#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
const int mod = 998244353;
const int inf = 1e17;
const int N = 1e5+5;
int32_t main(){
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
int ans = 0, cnt = 0;
for(int i = 0; i < n; i++){
if(s[i] == '0'){
cnt++;
ans = max(ans, cnt);
}
else{
cnt = 0;
}
}
cout<<ans<<endl;
}
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:58:18
- Judged At
- 2024-11-05 14:58:18
- Judged By
- Score
- 100
- Total Time
- 11ms
- Peak Memory
- 884.0 KiB