HDU1996 汉诺塔VI

问题链接:HDU1996 汉诺塔VI。水题,用C语言编写程序。

问题简述:参见上述链接。

问题分析:本题实际上是计算3^n。编程中需要注意输出格式。

程序说明:(略)

AC的C语言程序如下:

/* HDU1996 汉诺塔VI */

#include<stdio.h>
#include<math.h>

int main (void)
{
    int t, n;

    scanf("%d",&t);
    while(t--)
    {
        scanf("%d", &n);
        printf("%.lf\n", pow(3, n));
    }

    return 0;
}


posted on 2016-07-16 01:28  海岛Blog  阅读(129)  评论(0)    收藏  举报

导航