#include<iostream>
#include<iomanip>
using namespace std;
int main(){
double i,n,t,a,b;
double sum=0;
cin>>n;
a=2;
b=1;
for(i=0;i<n;++i){
sum+=double(a)/b;
t=a;
a=a+b;
b=t;
}
cout<<fixed<<setprecision(2)<<sum<<endl;
return 0;
}
循环-10. 求序列前N项和(15),布布扣,bubuko.com
原文地址:http://www.cnblogs.com/gnodidux/p/3820798.html