310408: CF1829B. Blank Space

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:8 Solved:0

Description

B. Blank Spacetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given a binary array $a$ of $n$ elements, a binary array is an array consisting only of $0$s and $1$s.

A blank space is a segment of consecutive elements consisting of only $0$s.

Your task is to find the length of the longest blank space.

Input

The first line contains a single integer $t$ ($1 \leq t \leq 1000$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \leq n \leq 100$) — the length of the array.

The second line of each test case contains $n$ space-separated integers $a_i$ ($0 \leq a_i \leq 1$) — the elements of the array.

Output

For each test case, output a single integer — the length of the longest blank space.

ExampleInput
5
5
1 0 0 1 0
4
0 1 1 1
1
0
3
1 1 1
9
1 0 0 0 1 0 0 0 1
Output
2
1
1
0
3

Input

题意翻译

# 题意简述 本题有 $t$ 组数据。对于每组数据,将会给出一个正整数 $n$ 和一个长度为 $n$ 的序列 $A$。 序列 $A$ 中的每个数字只会是 $0$ 或 $1$。 现在,请你求出每组数据中的序列 $A$ 的最长的连续的一段 $0$ 的长度。 Translate by @[tianbiandeshenghuo11](/user/752485)

Output

题目大意:
这个题目是关于给定一个只包含0和1的二元数组,要求找出最长的连续0的序列(即空白空间)的长度。

输入输出数据格式:
- 输入:
- 第一行包含一个整数t(1 ≤ t ≤ 1000),表示测试用例的数量。
- 每个测试用例的第一行包含一个整数n(1 ≤ n ≤ 100),表示数组的长度。
- 每个测试用例的第二行包含n个空格分隔的整数a_i(0 ≤ a_i ≤ 1),表示数组的元素。
- 输出:
- 对于每个测试用例,输出一个整数,表示最长的空白空间的长度。

示例:
```
输入:
5
5
1 0 0 1 0
4
0 1 1 1
1
0
3
1 1 1
9
1 0 0 0 1 0 0 0 1

输出:
2
1
1
0
3
```

请注意,这个问题是一个编程问题,需要编写代码来解决问题。如果你需要帮助编写解决问题的代码,请告诉我。题目大意: 这个题目是关于给定一个只包含0和1的二元数组,要求找出最长的连续0的序列(即空白空间)的长度。 输入输出数据格式: - 输入: - 第一行包含一个整数t(1 ≤ t ≤ 1000),表示测试用例的数量。 - 每个测试用例的第一行包含一个整数n(1 ≤ n ≤ 100),表示数组的长度。 - 每个测试用例的第二行包含n个空格分隔的整数a_i(0 ≤ a_i ≤ 1),表示数组的元素。 - 输出: - 对于每个测试用例,输出一个整数,表示最长的空白空间的长度。 示例: ``` 输入: 5 5 1 0 0 1 0 4 0 1 1 1 1 0 3 1 1 1 9 1 0 0 0 1 0 0 0 1 输出: 2 1 1 0 3 ``` 请注意,这个问题是一个编程问题,需要编写代码来解决问题。如果你需要帮助编写解决问题的代码,请告诉我。

加入题单

上一题 下一题 算法标签: