View Code of Problem 3695

#include<iostream>
using namespace std;


int main() {
	int n, t;
	cin >> n;
	while (n--) {
		long long a[90] = {1,2};
		cin >> t;
		long long sum = 3;
		for (int i = 2; i < t; ++i) {
			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