//第一种解法,单for,关键是t*=i这行
# include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double e,s;
e=1.0;
s=0.0;
long long t=1;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{t*=i;//关键步骤,它存储了以前的结果
e+=1.0/t;
}
printf("%.10lf",e);
return 0;
}
//第二种解法,两层for循环,内for循环完后,t=1
# include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
double e,s;
e=1.0;
s=0.0;
long long t=1;
scanf("%d",&n);
for(int i=1;i<=n;i++){
for(int ls=1;ls<=i;ls++){
t*=ls;
}
e+=1.0/t;
t=1;
}
printf("%.10lf",e);
return 0;
}