/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 20ms 532.0 KiB
#3 Accepted 4ms 320.0 KiB
#4 Accepted 2ms 532.0 KiB
#5 Accepted 2ms 532.0 KiB
#6 Accepted 3ms 696.0 KiB
#7 Accepted 3ms 788.0 KiB
#8 Accepted 3ms 740.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
#define pub push_back
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);
using namespace std;
void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    for (char c : s)
    {
        if (c == '0')
            cnt++;
        else
        {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);
    cout << ans << endl;
}
int main()
{
    fast;
    ll t;
    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:38:24
Judged At
2024-11-05 14:38:24
Judged By
Score
100
Total Time
20ms
Peak Memory
788.0 KiB