好好的按公式打的代码。
#include<bits/stdc++.h> using namespace std; int main(){ float a,b; cin>>a; b=(pow((1+sqrt(5))/2,a)-pow((1-sqrt(5))/2,a))/sqrt(5); printf("%.2f",b); }