Closed houcy closed 10 months ago
目前不支持函数递归调用,希望能够完善增强一下,谢谢!
using namespace std;
int f(int n) { if (n <= 2) return n; return f(n - 1) + f(n - 2); }
int main() { int n, ans = 0; cin >> n; ans = f(n); cout << ans << endl; return 0; }
只支持单函数的,递归调用的应该也没法画流程图
目前不支持函数递归调用,希望能够完善增强一下,谢谢!
include <bits/stdc++.h>
using namespace std;
int f(int n) { if (n <= 2) return n; return f(n - 1) + f(n - 2); }
int main() { int n, ans = 0; cin >> n; ans = f(n); cout << ans << endl; return 0; }