1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
using
namespace
std;
double
e[1000001];
int
main()
{
int
t,i,n;
e[1]=1.000000;
for
(i=2;i<=1000001;i++)
{
e[i]=(e[i-1]+1.0)/(2*i-1)+e[i-1]*(2*i-2)/(2*i-1);
}
scanf
(
"%d"
,&t);
while
(t--)
{
scanf
(
"%d"
,&n);
printf
(
"%lf\n"
,e[n]);
}
return
0;
}
/**************************************************************
Problem: 1484
User: 1307122118
Language: C++
Result: 正确
Time:119 ms
Memory:9064 kb
****************************************************************/
|