-->
当前位置:首页 > 题库

PROGRAMMING:Echelon clouds

Luz5年前 (2021-05-10)题库436
After Newton's grandmaster announced that he would not be in charge of China Film and Television City, he could take off and go straight to the moon. Suppose that the horizontal * is only $$n $$m away from the moon, and a slow motion of the horizontal * handle's left foot and right foot can rise by $$1 $$m or $$2 $$m with equal probability. Please calculate his steps to the moon.
Note that when he is only $$1 $$m away from the moon, he will choose to rise $$1 $$m with a $$100 $% probability.
Let $$x $$step to the moon probability $$p (x) $$be, then the expected number of steps to land on the moon $$= - sum_{ X=0}^{n}P(X)*X$$
###Input format:
Input the number of sample groups in the first line $$t (1 < = T < = 100)$$
After the $$t $$line, each line gives a positive integer $$n (1 < = n < = 10 ^ 5) $$indicating that there are $$n $$meters in the moon
###Output format:
For each set of data, the number of steps to the moon in a row is expected to be rounded to 6 decimal places.
###Input example:
Here is a set of inputs. For example:
```in
three
one
two
three
```
###Output example:
The corresponding output is given here. For example:
```out
one
one point five zero zero zero zero zero
two point two five zero zero zero zero
```
###Tips:
20% data, $$1 < = n < = 10$$
40% of the data, $$1 < = n < = 10 ^ 2$$
60% of data, $$1 < = n < = 10 ^ 4$$
100% data, $$1 < = n < = 10 ^ 5$$







answer:If there is no answer, please comment