/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 98ms 10.914 MiB
#2 Accepted 428ms 33.906 MiB
#3 Accepted 263ms 21.672 MiB
#4 Accepted 156ms 15.867 MiB
#5 Accepted 196ms 16.617 MiB
#6 Accepted 202ms 17.762 MiB
#7 Accepted 184ms 16.871 MiB
#8 Accepted 194ms 17.824 MiB

Code

import java.util.Scanner;

public class Main {
    
    static Scanner in = new Scanner(System.in);
    
    static int n, h, w, testCases;
    
    static char x[];
    
    static void solve() {
        
        int maxConsecutiveZero = 0;
        
        for(int i = 0, count = 0; i < n; ++i) {
            
            if(x[i] == '0') {
                
                ++count;
                
            } else {
                
                count = 0;
                
            }
            
            maxConsecutiveZero = Math.max(maxConsecutiveZero, count);
            
        }
        
        System.out.println(maxConsecutiveZero);
        
    }
    
  public static void main(String args[]) {
   
      testCases = in.nextInt();
      
      for(int t = 0; t < testCases; ++t) {
          
          input();
          solve();
          
      }
   
  }
  
  private static void input() {
      
      n = in.nextInt();
      x = in.next().toCharArray();
     
  }
  
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Contest
Brain Booster #7
Language
Java 8 (OpenJDK 1.8.0_422)
Submit At
2024-11-05 15:12:58
Judged At
2024-11-11 02:31:12
Judged By
Score
100
Total Time
428ms
Peak Memory
33.906 MiB