ACM1996
/*
汉诺塔VI
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1080 Accepted Submission(s): 761
发生错移产生的系列就增加了,这种错误是放错了柱子,并不会把大盘放到小盘上,即各柱
子从下往上的大小仍保持如下关系 :
n=m+p+q
a1>a2>...>am
b1>b2>...>bp
c1>c2>...>cq
计算所有会产生的系列总数.
目N<30.
*/
#include<iostream>
#include<cmath>
int main()
{
using namespace std;
unsigned t,n;
unsigned long long result;
cin>>t;
while(t--)
{
cin>>n;
cout<<(unsigned long long)pow(3,n)<<endl;
}
return 0;
}
/*#include <stdio.h>
#include <math.h>
int main()
{
int t,n;
scanf("%d",&t);
while(t-- && scanf("%d",&n))
printf("%I64d\n",(__int64)pow(3.0,n));
return 0;
}*/
ACM1996的更多相关文章
随机推荐
- python os.stat() 和 stat模块详解
stat 系统调用时用来返回相关文件的系统状态信息的. 首先我们看一下stat中有哪些属性: >>> import os >>> print os.stat(&qu ...
- 254. Factor Combinations
题目: Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a ...
- Android关于实现EditText中加多行下划线的的一种方法
1. 重写EditText public class LinedEditText extends EditText { private Paint linePaint; private float m ...
- 删除单链表的倒数第k个结点
策略 直接遍历总数为len,再次遍历第len-k+1个就是答案,但是这样遍历了O(N+k)个,可以在O在更短的时间内找到 图示 参考代码 #include <iostream> using ...
- DNS主配置文件的几个选项
options块中: listen-on port 监听DNS查询请求的本机IP地址及端口 eg:listen-on port 53 { 192.168.0.78 };监听本机的192. ...
- LTDFZ
开关稳压器
- Internet Explorer for Mac the Easy Way: Run IE 7, IE8, & IE9 Free in a Virtual Machine
From link: http://osxdaily.com/2011/09/04/internet-explorer-for-mac-ie7-ie8-ie-9-free/ If you’re ...
- Jenkins iOS – Git, xcodebuild, TestFlight
Introduction with Jenkins iOS If you are new to continuous integration for mobile platforms then you ...
- Facebook存储技术方案:找出“暖性BLOB”数据
Facebook公司已经在其近线存储体系当中彻底弃用RAID与复制机制,转而采用分布式擦除编码以隔离其所谓的“暖性BLOB”. 暖性?BLOB?这都是些什么东西?大家别急,马上为您讲解: BLOB—— ...
- 前端SPA框架一些看法
说起前端框架,我个人主张有框架不如无框架,这个观点要先从框架和库的区别说起. 我所理解的库,解决的是代码或是模块级别的复用或者对复杂度的封装问题;而框架,更多的是对模式级别的复用和对程序组织的规范,这 ...