You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
//著名的斐波纳契数列
|
|
int Fibonacci(int n) {
|
|
if (n == 0) return 0;
|
|
if (n == 1) return 1;
|
|
return Fibonacci(n - 1) + Fibonacci(n - 2);
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
cout << Fibonacci(n) << endl;
|
|
return 0;
|
|
}
|