CF1829B.Blank Space
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a binary array a of n elements, a binary array is an array consisting only of 0s and 1s.
A blank space is a segment of consecutive elements consisting of only 0s.
Your task is to find the length of the longest blank space.
给你一个长度为 n 的二进制数组 a,二进制数组是指仅由 0 和 1 组成的数组。
空白段是指由连续的 0 构成的一段子数组。
你的任务是找出最长空白段的长度。
输入格式
The first line contains a single integer t (1≤t≤1000) — the number of test cases.
The first line of each test case contains a single integer n (1≤n≤100) — the length of the array.
The second line of each test case contains n space-separated integers ai (0≤ai≤1) — the elements of the array.
第一行包含一个整数 t(1≤t≤1000)—— 测试用例的数量。
每个测试用例的第一行包含一个整数 n(1≤n≤100)—— 数组的长度。
每个测试用例的第二行包含 n 个以空格分隔的整数 ai(0≤ai≤1)—— 数组的元素。
输出格式
For each test case, output a single integer — the length of the longest blank space.
对于每个测试用例,输出一个整数——最长空白段的长度。
输入输出样例
输入#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
输出#1
2 1 1 0 3
输入解题思路,AI测评打分。不知道怎么写?