标签:span nbsp ble bit fine lowbit 大盘 stream problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1996
Input包含多组数据,首先输入T,表示有T组数据.每个数据一行,是盘子的数
目N<30.Output对于每组数据,输出移动过程中所有会产生的系列总数。Sample Input
3 1 3 29
Sample Output
3 27 68630377364883
题解:每个盘子都有三种选择,所以是3的n方
1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 #include <cstdio> 5 #include <vector> 6 #include <cstdlib> 7 #include <iomanip> 8 #include <cmath> 9 #include <ctime> 10 #include <map> 11 #include <set> 12 #include <queue> 13 using namespace std; 14 #define lowbit(x) (x&(-x)) 15 #define max(x,y) (x>y?x:y) 16 #define min(x,y) (x<y?x:y) 17 #define MAX 100000000000000000 18 #define MOD 1000000007 19 #define pi acos(-1.0) 20 #define ei exp(1) 21 #define PI 3.141592653589793238462 22 #define INF 0x3f3f3f3f3f 23 #define mem(a) (memset(a,0,sizeof(a))) 24 typedef long long ll; 25 ll gcd(ll a,ll b){ 26 return b?gcd(b,a%b):a; 27 } 28 bool cmp(int x,int y) 29 { 30 return x>y; 31 } 32 const int N=10005; 33 const int mod=1e9+7; 34 int main() 35 { 36 int t; 37 cin>>t; 38 while(t--){ 39 int n; 40 ll m; 41 cin>>n; 42 m=pow(3,n); 43 cout<<m<<endl; 44 } 45 return 0; 46 }
标签:span nbsp ble bit fine lowbit 大盘 stream problem
原文地址:http://www.cnblogs.com/shixinzei/p/7298023.html