题目描述Description给定A、B、C三根足够长的细柱,在A柱上放有2n个中间有孔的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的(下图为n=3的情形)。现要将这些圆盘移到C柱上,在移动过程中可放在B柱上暂存。要求:(1)每次只能移动一个圆盘;(2)A、B、C...
分类:
其他好文 时间:
2015-09-05 16:28:16
阅读次数:
304
1 #include 2 #include 3 using namespace std; 4 const int N=100; 5 int tower[N][N],f[N][N]={0},n; 6 void upMax(int &a,const int &b){ 7 a=(a>b?a:b)...
分类:
编程语言 时间:
2015-09-04 18:23:28
阅读次数:
252
A. Hanoi towerTime Limit: 1 SecMemory Limit: 256 MB题目连接http://codeforces.com/gym/100114Descriptionyou the conditions of this task. There are 3 pivots:...
分类:
其他好文 时间:
2015-09-03 19:14:44
阅读次数:
365
DescriptionThe cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 =0表示取...
分类:
编程语言 时间:
2015-09-02 21:54:00
阅读次数:
320
The Tower of BabylonTime Limit:3000MSMemory Limit:0KB64bit IO Format:%lld & %lluSubmitStatusPracticeUVA 437Appoint description:DescriptionPerhaps you ...
分类:
其他好文 时间:
2015-08-30 22:35:33
阅读次数:
152
题目传送门题意:给出一些砖头的长宽高,砖头能叠在另一块上要求它的长宽都小于下面的转头的长宽,问叠起来最高能有多高分析:设一个砖头的长宽高为x, y, z,那么想当于多了x, z, y 和y, x, z的砖头,如果i能叠在j上,那么g[i][j] = true,转换成DAG问题,dp[i]表示第i块叠...
分类:
其他好文 时间:
2015-08-29 12:20:58
阅读次数:
191
在写paper时,经常遇到LaTeX排版指定行列的子图形。以2X2子图为例,代码如下:
\usepackage{subfig}
\begin{figure*}[!htb]
\centering
\subfloat[Location of Cell Towers]{\includegraphics[width=0.47\textwidth]{figures/geo_tower.pdf}} ...
分类:
其他好文 时间:
2015-08-20 06:47:00
阅读次数:
685
题目描述:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2338
The Towers of Hanoi Revisited
Time Limit: 5 Seconds
Memory Limit: 32768 KB Special Judge
You all must...
分类:
其他好文 时间:
2015-08-15 11:59:00
阅读次数:
109
如果柱子标为A,B,C,要由A搬至C,在只有一个盘子时,就将它直接搬至C;当有两个盘子,就将B作为辅助柱;如果盘数超过2个,将第二个以下的盘子遮起来,就很简单了,每次处理两个盘子,也就是:A->B、A->C、B->C这三个步骤,而被遮起来的部分,其实就由方程的递归处理。
代码如下:
#include
void hanoi(int n,char A,char B,char C){...
分类:
其他好文 时间:
2015-08-14 19:08:22
阅读次数:
199
据说是DAG的dp,强行做成图论。用spfa,松弛操作改成变长。注意状态的表示。#includeusing namespace std;#define MP make_pair#define fi first#define se secondtypedef pair pii;const int N ...
分类:
其他好文 时间:
2015-08-12 01:09:58
阅读次数:
105