/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 25ms 324.0 KiB
#3 Accepted 6ms 320.0 KiB
#4 Accepted 4ms 320.0 KiB
#5 Accepted 5ms 580.0 KiB
#6 Accepted 6ms 680.0 KiB
#7 Accepted 6ms 820.0 KiB
#8 Accepted 6ms 748.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-11 02:32:31
Judged By
Score
100
Total Time
25ms
Peak Memory
820.0 KiB