/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 512.0 KiB
#2 Wrong Answer 4ms 512.0 KiB
#3 Wrong Answer 2ms 304.0 KiB

Code

/**
 * ! @Author : - Mohammed Murshedur Rahman
 * ? Date & Time : - 2024-11-05 21:00
 * * BANGLADESH : - SYLHET
 */

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

int maxValue(char* s, int n)
{
    int max1 = 0;
    int max2 = 0;  

    for (int i = 0; i < n; i++)
    {
        if (s[i] == '1')
        {
            max2++;
            if (max1 < max2)
            {
                max1 = max2;
            }
        }
        else
        {
            max2 = 0;
        }
    }
    return max1;
}

void solve()
{
    int n;
    scanf("%d", &n);
    char s[n+1];
    scanf("%s", s);
    int max_ones = maxValue(s, n);
    printf("%d\n", max_ones);
}

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

    while (t--)
    {
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Contest
Brain Booster #7
Language
C11 (GCC 13.2.0)
Submit At
2024-11-05 15:29:04
Judged At
2024-11-11 02:30:38
Judged By
Score
5
Total Time
4ms
Peak Memory
512.0 KiB