提交时间:2024-11-11 07:11:57
运行 ID: 56391
#include<iostream> #include<iomanip> using namespace std; int main() { int n; double s1=1,s2; cin>>n; for(int i1=1;i1<=n;i1++) { s2=1; for(int i2=1;i2<=i1;i2++) s2/=(double)i2; s1+=s2; } cout<<fixed<<setprecision(10)<<s1; return 0; }