P1720 月落乌啼算钱(斐波那契数列)
AD_McTorch · · 题解
哇,好水的题啊
这题直接根据题目条件打出来即可
代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
printf("%.2lf",double((pow((1+sqrt(5))/2,n)-pow((1-sqrt(5))/2,n))/sqrt(5)));
return 0;
}
AD_McTorch · · 题解
哇,好水的题啊
这题直接根据题目条件打出来即可
代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
printf("%.2lf",double((pow((1+sqrt(5))/2,n)-pow((1-sqrt(5))/2,n))/sqrt(5)));
return 0;
}