View Code of Problem 3695

#include <iostream>

using namespace std;

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

Double click to view unformatted code.


Back to problem 3695