用Java代码演示一下汉诺塔。

我可以用Java代码演示汉诺塔的算法: public class Hanoi { public static void main(String[] args) { move(3, 'A', 'B', 'C'); } public static void move(int n, char from, char to, char inter) { if (n == 1) { System.out.println("Move disk 1 from " + from + " to " + to);

猜你喜欢

转载自blog.csdn.net/weixin_42588672/article/details/129577769