提交时间:2020-10-31 20:19:00
运行 ID: 8458
#include<bits/stdc++.h> using namespace std; int a1[50]={0}; int main(){ int a; cin>>a; a1[1]=1; a1[2]=3; a1[3]=5; for(int i=3;i<=30;i++){ a1[i]=a1[i-1]+a1[i-2]*2; } for(int i=1;i<=a;i++){ int n; scanf("%d",&n); printf("%d\n",a1[n]); } }