AMZSEQ

AMZSEQ

#include<iostream>
using namespace std;
typedef long long int int64;
int main()
{
 int64 arr[10000];
 arr[1] = 3;
 arr[2] = 7;
 int i = 2;
 while(arr[i]<1e10)
 {
  arr[i+1] = 2*arr[i] + arr[i-1];
  i++;                 
 }   
 int n;
 cin>>n;
 cout<<arr[n]<<endl;
}

No comments:

Post a Comment