public class HinoTest {
public static int step=0;
/**
*
* @param num 盘子数
* @param a 柱子
* @param b 柱子
* @param c 柱子
*/
public static void hinoMove(int num,String a,String b,String c){
if (num==1)
move(num,a, c);
else {
hinoMove(num-1,a,c,b);
move(num,a,c);
hinoMove(num-1,b,a,c);
}
}
public static void move(int num,String a,String c){
step++;
System.out.println("第"+step+"步,第"+num+"个盘子"+"从"+a+"移动到"+c);
}
}