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