View Code of Problem 3695

#include <bits/stdc++.h>
using namespace std;


int main() {
	int n, t;
	cin >> n;
	while (n--) {
		long long a[90] = { 1,2 };
		cin >> t;
		long long sum = 0;
		for (int i = 0; i < t; ++i) {
			if (i > 1)
				a[i] = a[i - 1] + a[i - 2];
			sum += a[i];

		}
		cout << sum << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3695