/ SeriousOJ /

Record Detail

Accepted


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

Code

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

#define max 250000

int main() {
    int a;
    scanf("%d", &a);

    while (a--) {
        int b;
        scanf("%d", &b);

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

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

        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:23:29
Judged At
2024-11-05 16:23:29
Judged By
Score
10
Total Time
1ms
Peak Memory
796.0 KiB