mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
22 lines
323 B
C++
22 lines
323 B
C++
|
#include<iostream>
|
||
|
using namespace std;
|
||
|
const int maxn=32;
|
||
|
int arr[maxn]={0,1,3};
|
||
|
void func( void )
|
||
|
{
|
||
|
for(int i=3;i<=maxn;i++ )
|
||
|
arr[i]=arr[i-1]+2*arr[i-2];
|
||
|
}
|
||
|
int main( void )
|
||
|
{
|
||
|
int t,n;
|
||
|
func();
|
||
|
cin>>t;
|
||
|
while(t--)
|
||
|
{
|
||
|
cin>>n;
|
||
|
cout<<arr[n]<<endl;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|