git reimport
This commit is contained in:
35
archive/2019.03/2019.03.14 - Yandex.Interview/B.java
Normal file
35
archive/2019.03/2019.03.14 - Yandex.Interview/B.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package chelper;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import solutions.ChelperSolution;
|
||||
|
||||
|
||||
public class B extends ChelperSolution {
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
super.solve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
|
||||
int maxLength = 0;
|
||||
int curLength = 0;
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
int x = in.nextInt();
|
||||
|
||||
if (x == 0) {
|
||||
curLength = 0;
|
||||
} else {
|
||||
curLength++;
|
||||
maxLength = Math.max(curLength, maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
out.println(maxLength);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user