Accepted
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