CF2162A.Beautiful Average

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Beautiful Average

You are given an array aa of length nn.

Your task is to find the maximum possible average value of any subarray^{\text{∗}} of the array aa.

Formally, for any indices l,rl, r such that 1lrn1 \le l \le r \le n, define the average of the subarray al,al+1,,ara_l, a_{l+1}, \dots, a_r as the sum of elements divided by the number of elements or: $$\texttt{avg}(l,r) = \frac{1}{r-l+1} um_{i=l}^{r} a_i$$Output the maximum value ofavg(l,r)\texttt{avg}(l,r)over all choices ofl,rl, r.

^{\text{∗}}An arraybbis a subarray of an arrayaaifbbcan be obtained fromaa by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. In particular, an array is a subarray of itself.

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

The first line of each testcase contains a single integer nn (1n101 \le n \le 10) — the length of the array aa.

The second line of each testcase contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai101 \le a_i \le 10) — the elements of the array.

Output

For each testcase, output a single integer — the maximum average of any subarray of the given array.

It can be shown that the answer is always an integer.

Samples

3
4
3 3 3 3
5
7 1 6 9 9
5
3 4 4 4 3
3
9
4

在线编程 IDE

建议全屏模式获得最佳体验