logo AlgoBeat OnlineJudge
登录 注册

#102489. [BZOJ 2489] Random Sequence

内存限制:128 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

There is a random sequence whose element are all random numbers either or with the same possibility.Now we define MAVS,the abbreviate of Maximum Absolute Value Subsequence,to be any (if more than one) subsequences of whose absolute value is maximum among all subsequences.Given the length of ,your task is to find the expectation of the absolute value of MAVS.

输入格式

There is only one input file.The first line is the number of test cases positive integers follow,each of which contains one positive number not greater than denoted the length of

给你一个数字 ,代表数字串长。这个数字串每个元素为
那么就有这个数列有 种可能。
现对每个可能的数字串,求其连续子串和,并将和取绝对值,记下最大的那个值。
再求出所有这些值的总和。
输入总和/

输出格式

For each test case,output the expectation you are required to calculate.Answers are rounded to numbers after the decimal point.(as shown in the sample output)

样例

样例输入 #1

3
1
5
10

样例输出 #1

Case 1: 1.000000
Case 2: 2.750000
Case 3: 4.167969

数据范围与提示

当输入2时,有

1 1
1 -1
-1 1
-1 -1

这四种可能,其对应的值分别为

acm 2011 福州