请问各位大佬们,哪里有问题啊编译失败
查看原帖
请问各位大佬们,哪里有问题啊编译失败
1504215
zlh202483023楼主2024/11/21 16:04
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
	int n,i;
	double a, b;
	cin >> n;
	a = 1.0;
	b = 1.0;
	for (i = 0; i < n; i++) {
		a = a* (1 + sqrt(5)) / 2;
		b = b* (1 - sqrt(5)) / 2;
	}
	cout << fixed<<setprecision(2)<<(a - b) / sqrt(5);
	return 0;
}
2024/11/21 16:04
加载中...