/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 24ms 532.0 KiB
#3 Accepted 7ms 532.0 KiB
#4 Accepted 4ms 532.0 KiB
#5 Accepted 6ms 536.0 KiB
#6 Accepted 6ms 788.0 KiB
#7 Accepted 6ms 928.0 KiB
#8 Accepted 6ms 856.0 KiB

Code

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

void solve() {
    long long n;
    cin>>n;
    string s;
    cin>>s;

    string s1 = ""; 
    for(char c:s) {
        s1+=(c=='0') ?'1':'0';
    }
    long long mx= 0, count = 0;
    for (char c : s1){
        if (c=='1'){
            count++;
            mx=max(mx, count);
        } else {
            count=0;
        }
    }
    cout<<mx<<endl;
}

int main() {
    int 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 16:02:52
Judged At
2024-11-05 16:02:52
Judged By
Score
100
Total Time
24ms
Peak Memory
928.0 KiB