2460: Room and Moor
内存限制:128 MB
时间限制:30.000 S
评测方式:文本比较
命题人:
提交:0
解决:0
题目描述
PM Room defines a sequence A = {A1, A2,..., AN}, each of which is either 0 or 1. In order to beat him, programmer Moor has to construct another sequence B = {B1, B2,... , BN} of the same length, which satisfies that:
输入
The input consists of multiple test cases. The number of test cases T(T<=100) occurs in the first line of input.
For each test case:
The first line contains a single integer N (1<=N<=100000), which denotes the length of A and B.
The second line consists of N integers, where the ith denotes Ai.
输出
Output the minimal f (A, B) when B is optimal and round it to 6 decimals.
样例输入 复制
4
9
1 1 1 1 1 0 0 1 1
9
1 1 0 0 1 1 1 1 1
4
0 0 1 1
4
0 1 1 1
样例输出 复制
1.428571
1.000000
0.000000
0.000000