

Room and MoorTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1731 Accepted Submission(s): 599 Problem Description PM Room defines a sequence A = {A_{1}, A_{2},..., A_{N}}, each of which is either 0 or 1. In order to beat him, programmer Moor has to construct another sequence B = {B_{1}, B_{2},... , B_{N}} of the same length, which satisfies that: Input 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 A_{i}. Output Output the minimal f (A, B) when B is optimal and round it to 6 decimals. Sample Input
Sample Output
Author BUPT Source  
