/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 93ms 15.344 MiB
#2 Accepted 464ms 32.539 MiB
#3 Accepted 236ms 22.469 MiB
#4 Accepted 166ms 18.219 MiB
#5 Accepted 202ms 17.859 MiB
#6 Accepted 219ms 20.906 MiB
#7 Accepted 217ms 19.188 MiB
#8 Accepted 244ms 20.98 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-05 15:12:58
Judged By
Score
100
Total Time
464ms
Peak Memory
32.539 MiB