Skip to content

Instantly share code, notes, and snippets.

@h3ct0rjs
Created April 18, 2016 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h3ct0rjs/aab1f4680a1d093fcdf12c0d7b14c0c7 to your computer and use it in GitHub Desktop.
Save h3ct0rjs/aab1f4680a1d093fcdf12c0d7b14c0c7 to your computer and use it in GitHub Desktop.
quick test of something
#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