View Code of Problem 3695

#include <iostream>
using namespace std;
int main(){
	int t,n,a[100];
	cin>>t;
	a[1]=1;a[2]=2;
	for(int i=3;i<=90;i++){
		a[i]=a[i-1]+a[i-2];
	}
	while(t--){
		cin>>n;
		int sum=0;
		for(int i=1;i<=n;i++)
			sum+=a[i];
		cout<<sum<<endl;
		
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3695