|
|
back to boardC++ accepted Posted by Evgeny 31 Jul 2023 19:58 #include <iostream> #include <vector> using namespace std; int main() { int N = 45; int M; cin >> M; vector <long long> a(N+2); a[0] = 2, a[1] = 2;
for (int i = 0; i < N; i++) { a[i+2] = (a[i+1] + a[i]); }
//Fibonacci sequence
// F0 = 2; // F1 = 2; // Fn = Fn-1 + Fn-2 cout << a[M-1]; return 0; } |
|
|