Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129481 常钰杰 求解函数 C++ Compile Error 0 MS 0 KB 305 2025-08-26 15:54:45

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; double f(int x, int n) { if(n == 1) { return (x / (1 + x)); } else { return (x / n + f(x, n - 1))); } } int main() { int x, n; cin >> x >> n; printf("%.2lf", f(x, n)); return 0; }


Run Info:

Main.cc: In function 'double f(int, int)':
Main.cc:13:37: error: expected ';' before ')' token
         return (x / n + f(x, n - 1)));
                                     ^
Main.cc:13:37: error: expected primary-expression before ')' token