80分求助,第三个测试点wa了
查看原帖
80分求助,第三个测试点wa了
1534735
ParkourCat楼主2024/11/27 21:00
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	double a,b;
	a=(1+sqrt(5))*0.5;
	b=(1-sqrt(5))*0.5;
	double a1=a;
	double b1=b;
	for(int i=2;i<=n;i++){
		a=a*a1;
	}
	for(int i=2;i<=n;i++){
			b=b*b1;
		}
	double c=a-b;
	double d=c/sqrt(5);
	cout<<fixed<<setprecision(2)<<d;
	return 0;
}
2024/11/27 21:00
加载中...