悼念512汶川大地震遇难同胞——重建希望小学

#include<iostream>
using namespace std;
int main()
{
    int t,n,f[31];
    f[1]=1,f[2]=3,f[3]=5;
    for(int i=4;i<31;i++)
        f[i]=f[i-1]+2*f[i-2];
    while(cin>>t){
        while(t--){
            cin>>n;
            cout<<f[n]<<endl;
        }
    }
    return 0;
}

相关文章:

  • 2021-06-17
  • 2021-11-12
  • 2021-08-25
  • 2022-12-23
  • 2021-10-07
  • 2021-07-01
猜你喜欢
  • 2022-01-29
  • 2022-01-12
  • 2021-12-06
  • 2021-10-07
  • 2021-08-18
  • 2022-01-14
相关资源
相似解决方案