CF1616C.Representative Edges
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An array a1,a2,…,an is good if and only if for every subsegment 1≤l≤r≤n , the following holds: al+al+1+…+ar=21(al+ar)⋅(r−l+1) .
You are given an array of integers a1,a2,…,an . In one operation, you can replace any one element of this array with any real number. Find the minimum number of operations you need to make this array good.
输入格式
The first line of input contains one integer t ( 1≤t≤100 ): the number of test cases.
Each of the next t lines contains the description of a test case.
In the first line you are given one integer n ( 1≤n≤70 ): the number of integers in the array.
The second line contains n integers a1,a2,…,an ( −100≤ai≤100 ): the initial array.
输出格式
For each test case, print one integer: the minimum number of elements that you need to replace to make the given array good.
输入输出样例
输入#1
5 4 1 2 3 4 4 1 1 2 2 2 0 -1 6 3 -2 4 -1 -4 0 1 -100
输出#1
0 2 0 3 0
说明/提示
In the first test case, the array is good already.
In the second test case, one of the possible good arrays is [1,1,1,1] (replaced elements are underlined).
In the third test case, the array is good already.
In the fourth test case, one of the possible good arrays is [−2.5,−2,−1.5,−1,−0.5,0] .