答案

爱学习的皮卡丘  •  2天前


include<bits/stdc++.h>

using namespace std; int main(){

int n;
double a=2, b=1, sum = 0.0;
double temp;
cin>>n;
for(int i = 1;i<=n;i++)
{
	sum+=a/b;
	temp=a;
	a=a+b;
	b=temp;
}
printf("%lf",sum);
return 0;

}


评论:

请先登录,才能进行评论