/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 808.0 KiB

Code

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAXN 200005

int main() {
    int a, b;

    scanf("%d",&a);

    while (a--) {
        int roy=0, emon=0; 
        scanf("%d",&b);

        
        char x[MAXN];
        scanf("%s", x);

        for (int i=0;i<b;i++) {
            if (x[i]=='1') {
                emon++;
            } 
            else {
                if (emon>roy) {
                    roy=emon;
                }
                emon=0;
            }
        }

        if (emon>roy) {
            roy=emon;
        }

        printf("%d\n",roy);
    }

    return 0;
}

Information

Submit By
Type
Pretest
Problem
P1113 Fliping Game
Language
C99 (GCC 13.2.0)
Submit At
2024-11-05 16:14:43
Judged At
2024-11-05 16:14:43
Judged By
Score
10
Total Time
1ms
Peak Memory
808.0 KiB