#include<iostream> #include<cstdio> using namespace std; const int maxn=1e5; double p[maxn+50]; int n; void prepare() { p[1]=1.0; for(int i=1;i<=maxn;i++) p[i+1]=(double)(2*i-1)/(double)(2*i)*p[i]; } int main() { prepare(); scanf("%d",&n); for(int i=0;i<n;i++) { int x; scanf("%d",&x); printf("%.4lf\n",1-p[x/2]); } return 0; }题目地址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=498