Run ID:148750

提交时间:2026-02-28 19:03:52

#include <iostream> #include <iomanip> using namespace std; int main() { int n; cin >> n; if (n <= 0) { cout << "0.0000" << endl; return 0; } long long a = 1, b = 2; double total = 0.0; for (int i = 0; i < n; i++) { total += (double)b / a; long long temp = a + b; a = b; b = temp; } cout << fixed << setprecision(4) << total << endl; return 0; }