#4128. [GESP202512 七级 C++] 第 10 题

[GESP202512 七级 C++] 第 10 题

下面程序的运行结果为( )。

#include <iostream>
using namespace std;
int f(int n) {
    if (n <= 2) return n * 2;
    return f(n - 1) + f(n - 2);
}
int main() {
    cout << f(5) << endl;
    return 0;
}

{{ select(1) }}

  • 10
  • 16
  • 26
  • 30