标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8037 Accepted Submission(s): 4738
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int main() 6 { 7 int t,n; 8 int a[22]; 9 a[0]=1;a[1]=3; 10 for(int i=2;i<=20;i++) 11 a[i]=a[i-1]*2+a[i-2]; 12 scanf("%d",&t); 13 while(t--) 14 { 15 scanf("%d",&n); 16 printf("%d\n",a[n]); 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/--ZHIYUAN/p/5975174.html