/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 23ms 532.0 KiB
#3 Accepted 6ms 532.0 KiB
#4 Accepted 4ms 556.0 KiB
#5 Accepted 7ms 600.0 KiB
#6 Accepted 6ms 748.0 KiB
#7 Accepted 11ms 788.0 KiB
#8 Accepted 17ms 668.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long int

int maxLengthOfZeros(string& s) {
    int max_len = 0, current_len = 0;

    for (char ch : s) {
        if (ch == '0') {
            current_len++;
        } else {
            max_len = max(max_len, current_len);
            current_len = 0;
        }
    }
    max_len = max(max_len, current_len);
    
    return max_len;
}

void solve()
{
    ll n;
    cin >> n;
    string s;
    cin>>s;
    cout<<maxLengthOfZeros(s)<<endl;
}
int main()
{
    int tc = 1, cs = 1;
    cin >> tc;
    while (tc--)
    {
        // cout<<"Case "<<cs<<": ";
        solve();
    }
    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:46:57
Judged At
2024-11-05 14:46:57
Judged By
Score
100
Total Time
23ms
Peak Memory
788.0 KiB