杭电2042不容易系列之二

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2042

这道题是一个递归题!

#include <cstdlib>
#include <iostream>

using namespace std;
int f(int n)                      
{
    if(n==1)
      return 4;
    if(n>1)
      return (f(n-1)-1)*2;
}

int main(int argc, char *argv[])
{
    int n;
    cin>>n;
    while(n--)
    {
      int Station;
      cin>>Station;
      cout<<f(Station)<<endl;
    }
    system("PAUSE");
    return EXIT_SUCCESS;
}

经常回顾呀~~~~~~~~~~~~

原文地址:https://www.cnblogs.com/gkfeng/p/2619486.html