OJ-Problems-Source/HDOJ/3750_autoAC.cpp
2016-09-04 14:14:07 +08:00

24 lines
369 B
C++

#include<iostream>
using namespace std;
#include<cstring>
#include<stdio.h>
double a[100005];
int main()
{
int i,j,k;
int N;
a[0]=0;
a[1]=1;
a[2]=3.0;
for(i=3;i<100001;i++)
{
k=(1+i)/2;
a[i]=a[k-1]+k-1+a[i-k]+i-k+1;
}
while(cin>>N)
{
printf("%.2lf\n",a[N]/N);
}
return 0;
}