Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <cmath>
- #include <math.h>
- #include <vector>
- #include <queue>
- using namespace std;
- long long dp[1005];
- long long fib(int number) {
- if(number <= 2) {
- return 1;
- }
- if(dp[number] != -1) {
- return dp[number];
- }
- return dp[number] = fib(number - 1) + fib(number - 2);
- }
- int main()
- {
- memset(dp, -1, sizeof dp);
- cout << fib(50) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement