标签:
#include<stdio.h> #include<math.h> int main() { long long int Hanoi[25]; int i,n,t; Hanoi[2] = 4; Hanoi[1] = 2; for(i = 3;i <= 20;i ++) { Hanoi[i] = 3*(pow(3,i-2)-1) + 4; } scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%I64d\n",Hanoi[n]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/52Cassie/p/4945612.html