Problem Description
Tower of Hanoi minimum number of shifts is n disks of 2 ^ n-1, i.e., 2 ^ n generated during the move series. Since the error occurs shift produced series has increased, this error is the wrong column, will not put on the small cap market, that is, the size of each column up remains from the following relationship:
+ P = m + n-Q
A1> A2> ...> AM
B1> B2> ...> BP
C1> C2> ...> CQ
calculating the sum of all the series will produce.
A1> A2> ...> AM
B1> B2> ...> BP
C1> C2> ...> CQ
calculating the sum of all the series will produce.
Input
Comprising a plurality of sets of data, first input T, T represents a set of data has each data line, a number of plate
mesh N <30.
Output
For each test, the total number of output during movement of all the series will produce.
Sample Input
3
1
3
29
Sample Output
3
27
68630377364883
1 int main() 2 { 3 __int64 t,n,i; 4 __int64 sum,a[100]={3,}; 5 while(cin>>t) 6 while(t--) 7 { 8 cin>>n; 9 for(i=1;i<n;i++) 10 a[i]=a[i-1]*3; 11 cout<<a[n-1]<<endl; 12 } 13 return 0; 14 }