makeway @ 2024-08-24 19:35:58
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a=1,b=1,c=0,d;
double ans;
cin>>d;
for(int i=1;i<=d;i++){
c=a+b;
a=b;
b=c;
ans=b/a*1.0+ans;
}
cout <<fixed<<setprecision(4) <<ans <<endl;
return 0;
}
by scratch_szc @ 2024-08-24 19:38:11
为啥double ans?
by hhztl @ 2024-08-24 19:47:32
@makeway 你这发错地方了?
by zts201210 @ 2024-08-24 19:49:44
发错了吧,我看和这题没关系 @makeway
by makeway @ 2024-08-24 19:53:37
.........
by chenjinhang123 @ 2024-09-08 10:51:07
无语