指尖上的代码[C语言版]-<4>
<4>已知有三根针分别用A,B,C表示,在A针中自上而下从小到大放n个盘子,现要求把所有的盘子从A针全部移到C针,移动规则是:使用B针作为过度针,每次只移动一块盘子,且每根针上不能出现大盘压小盘,找出移动次数最小的方案.(汉诺塔问题)
分析:
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444141.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444142.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444143.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444144.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444145.jpg)
代码:
点石成金 写于 2012/08/07/21:38
发布时间: 2012-08-26 16:48:06 作者: rapoo
指尖上的代码[C语言版]-<4>
<4>已知有三根针分别用A,B,C表示,在A针中自上而下从小到大放n个盘子,现要求把所有的盘子从A针全部移到C针,移动规则是:使用B针作为过度针,每次只移动一块盘子,且每根针上不能出现大盘压小盘,找出移动次数最小的方案.(汉诺塔问题)
分析:
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444141.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444142.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444143.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444144.jpg)
![指尖下的代码[C语言版]-<4>](http://img.reader8.net/uploadfile/jiaocheng/20140134/2715/2014012701151444145.jpg)
代码:
点石成金 写于 2012/08/07/21:38