/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 26ms 560.0 KiB
#3 Wrong Answer 7ms 532.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) {
        if (c == '0') {
            s1 += '1';
        } else {
            s1 += '0';
        }
    }

    long long mx=1,cnt=1;
    for(int i=0; i<s1.size()-1; i++){
        if(s1[i]=='1' && s1[i+1]=='1'){
            cnt++;
            if(cnt>mx){
                mx=cnt;
            }
        }
        else cnt=1;
    }
    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 15:57:43
Judged At
2024-11-11 02:29:04
Judged By
Score
5
Total Time
26ms
Peak Memory
560.0 KiB