mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
21. 斐波那契数列
https://www.acwing.com/problem/content/submission/code_detail/2610805/
This commit is contained in:
parent
f385d08b6d
commit
352faa5ca0
9
AcWing/21/21.cpp
Normal file
9
AcWing/21/21.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
class Solution {
|
||||
public:
|
||||
int Fibonacci(int n) {
|
||||
if (n == 0) return 0;
|
||||
if (n == 1) return 1;
|
||||
if (n == 2) return 1;
|
||||
return Fibonacci(n - 1) + Fibonacci(n - 2);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user