mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
34806a93cd
2500-2599
13 lines
261 B
C++
13 lines
261 B
C++
#include<stdio.h>
|
|
int main(){
|
|
int m,i,n,a[21];
|
|
a[0]=0;a[1]=3;a[2]=7;
|
|
scanf("%d",&m);
|
|
while(m--){
|
|
scanf("%d",&n);
|
|
for(i=3;i<=n;i++){
|
|
a[i]=2*a[i-1]+a[i-2];}
|
|
printf("%d\n",a[n]);}
|
|
return 0;
|
|
}
|