forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.cpp
More file actions
21 lines (17 loc) · 311 Bytes
/
3.cpp
File metadata and controls
21 lines (17 loc) · 311 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
using namespace std;
long long d[100];
long long fibo(int x) {
cout << "f(" << x << ") ";
if (x == 1 || x == 2) {
return 1;
}
if (d[x] != 0) {
return d[x];
}
d[x] = fibo(x - 1) + fibo(x - 2);
return d[x];
}
int main(void) {
fibo(6);
}