求助

P1720 月落乌啼算钱(斐波那契数列)

``` #include<bits/stdc++.h> using namespace std; double c[100000]; double f(long long x){ if(x==0) return 0; if(x==1||x==2) return 1; if(c[x]>0) return c[x]; double a=f(x-1)+f(x-2); c[x]=a; return a; } int main(){ long long m; cin>>m; printf("%.2f",(double)f(m)); return 0; } ```
by drinktowind @ 2023-09-28 20:42:10


改了一下,精度有问题&初始值赋错了
by drinktowind @ 2023-09-28 20:43:02


求关QwQ
by drinktowind @ 2023-09-28 20:43:38


@[drinktowind](/user/719619) 谢谢
by Ac_Code_cn_com @ 2023-09-28 20:47:20


|