hdu 1996ハノータVI

1912 ワード

タイトルリンクhttp://acm.hdu.edu.cn/showproblem.php?pid=1996
Problem Description
n                 2^n-1,          2^n   。  
             ,          ,           ,   
                :
n=m+p+q 
a1>a2>...>am
b1>b2>...>bp
c1>c2>...>cq
            .


Input
      ,    T,   T   .      ,     
 N<30.


Output
      ,                 。


Sample Input
3
1
3 
29


Sample Output
3
27
68630377364883

サンプルを見てあげると、29^3はやはり68・・・・・・・・・・・・・・お皿ごとに3種類の選択肢があるようで、渡すとやはり正しいです.
#include <iostream>
#include <cmath>
using namespace std;

int main()
{int n;
 int t;
 cin>>t;
 while(t--)
 {
     cin>>n;
     cout<<(long long)pow(3.0,n)<<endl;
 }

    return 0;
}