Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by squall ( 6 years ago )
#include <iostream>
using namespace std;

const int N = 1000000;

long long f[N] = { 0 };

long long fibo(int n) {
	if (n <= 1) return 1;
	if (f[n] != 0) return f[n];
	f[n] = fibo(n-1) + fibo(n-2);
	return f[n];
}

int main() {
	int n;
	cin >> n;
	cout << fibo(n) << endl;
}

 

Revise this Paste

Your Name: Code Language: