CSQOJ
Home
ProblemSet
Source/Category
Contest
Status
Ranklist
F.A.Qs
Login
2487: 【编程入门】汉诺塔的移动次数
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:3
Solved:3
Submit
Submit Record
Statistics
Web Board
图形化编程
ShowOff!
Description
汉诺塔的问题大家都已经很熟悉了,有三个柱子,每个柱子上有一些大小不一的金片,要把金片从A柱移动到C柱,可以借助B柱,请问n个金片的情况下,需要最少移动多少次?
Input
输入一个整数n代表金片的数量(n<=20)
Output
一个整数,代表n个金片的移动次数
Sample Input
Copy
3
Sample Output
Copy
7
Source/Category
递归