|
||||||||||
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 = {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: 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 Ai. Output Output the minimal f (A, B) when B is optimal and round it to 6 decimals. Sample Input
Sample Output
Author BUPT Source | ||||||||||
|