View Code of Problem 3695

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a;
	cin>>n;
	long long int t[90];
	long long int sum;
	t[1]=1,t[2]=2;
	for(int i=3;i<=90;i++){
		t[i]=t[i-1]+t[i-2];
	}
	for(int i=0;i<n;i++){
		sum=0;
		cin>>a;
		for(int j=1;j<=a;j++){
			sum=sum+t[j];
		} 
		cout<<sum<<endl;
	}
} 

Double click to view unformatted code.


Back to problem 3695