We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int fib(int n) { // 迭代版 int f = 1, g = 0; // 初始化 fib(-1),fib(0) while (0 < n--) { g += f; f = g - f; // 依据原始定义,通过 n 次加法和减法计算 fib(n) } return g; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
int fib(int n) { // 迭代版
int f = 1, g = 0; // 初始化 fib(-1),fib(0)
while (0 < n--) {
g += f;
f = g - f; // 依据原始定义,通过 n 次加法和减法计算 fib(n)
}
return g;
}
The text was updated successfully, but these errors were encountered: