/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 25ms 556.0 KiB
#3 Wrong Answer 8ms 540.0 KiB

Code

#include <iostream>
#include <string>

using namespace std;

int main() {
    int T;
    cin >> T;

    while (T--) {
        int N;
        cin >> N;
        string S;
        cin >> S;

        int max_count = 0, current_count = 0;

        for (char c : S) {
            if (c == '1') {
                current_count++;
            } else {
                max_count = max(max_count, current_count);
                current_count = 0;
            }
        }

        // Handle the case where the string ends with 1s
        max_count = max(max_count, current_count);

        cout << max_count << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-06 14:15:09
Judged At
2024-11-11 02:24:55
Judged By
Score
5
Total Time
25ms
Peak Memory
556.0 KiB