/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 4ms 580.0 KiB
#3 Accepted 3ms 320.0 KiB
#4 Accepted 2ms 532.0 KiB
#5 Accepted 2ms 536.0 KiB
#6 Accepted 2ms 776.0 KiB
#7 Accepted 2ms 836.0 KiB
#8 Accepted 2ms 744.0 KiB

Code

// Created on: 2024-11-05 20:16
// Author: Safwan_Ibrahim

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'

void solve()
{   
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        int a = 0;
        bool en = false;
        while(i < n && s[i] == '0') {
            a++;
            i++;
            en = 1;
        }
        if(en) {
            i--;
        }
        ans = max(ans,a);
    }
    cout << ans << endl;
    
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1; cin >> t;
    while(t--) 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:52:11
Judged At
2024-11-11 02:32:19
Judged By
Score
100
Total Time
4ms
Peak Memory
836.0 KiB