Tanky WooRSS

HDOJ 2077 汉诺塔IV

05 Aug 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=2077

这2题差不多:http://www.wutianqi.com/?p=561


经过MiYu大神的指点,还是迷糊。

做汉诺塔3怪好的。。。。

过几天再想想~~~


#include 

using namespace std;
  // 2077
int arr[22];
int main()
{
    arr[1] = 1;
    for(int i=2; i<=20; i++)
    {
        arr[i] = arr[i-1]*3;
    }
    int nCases, nNum;
   cin >> nCases;
    while(nCases--)
    {
        while(cin >> nNum)
            cout << arr[nNum]+1 << endl;
    }

    return 0;
}