Created
April 18, 2016 04:59
-
-
Save h3ct0rjs/aab1f4680a1d093fcdf12c0d7b14c0c7 to your computer and use it in GitHub Desktop.
quick test of something
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL); | |
using namespace std; | |
long long fibonacci(int n); | |
int main(){ | |
fast; | |
int x;cin>>x; | |
cout<<fibonacci(x)<<endl; | |
} | |
//this is a very bad example of recursion or atleast it doesn't finish very quick. | |
long long fibonacci(int n){ | |
return (n == 1 || n == 2) ? 1 : fibonacci(n - 1) + fibonacci(n - 2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment