第六个斐波那契数是多少
约定 fib(0)=0、fib(1)=1。运行下面这段程序:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
long long fib(int n) {
if (n <= 1) return n;
return fib(n - 1) + fib(n - 2);
}
int main() {
cout << fib(6) << endl;
}
(本题用 g++ -std=c++17 -O0 编译。)