- 4
- 0
- 约1.62万字
- 约 72页
- 2019-03-21 发布于天津
- 举报
main() { int n; printf(Input the number of disks scanf(%d,n); printf(The steps to moving %3d hanoi(n,X,Y,Z); (0) } void hanoi(int n,char X,char Y,char Z) (1) { (2) if(n==1) (3) move(1,X,Z); (4) else{ (5) hanoi(n-1,X,Z,Y); (6) move(n,X,Z); (7) hanoi(n-1,Y,X,Z); (8) } (9) } A B C 3 A B C 0 2 B A C 8 3 A B C 0 2 B A C 8 1 B C A 6 A B C 3 A B C 0 2 B A C 8 3 A B C 0 main() { int n; printf(Inp
原创力文档

文档评论(0)