Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
148750 杨润东 13分数求和 C++ Accepted 0 MS 272 KB 453 2026-02-28 19:03:52

Tests(10/10):


Code:

#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; }