???????????
???????????? ???????[ 2013/1/10 9:50:23 ] ????????
???????????????????????????????????????ɡ?
??????????????
?????????????????????????????????????????????鶼???????????????????????????????????????
????(1)??????????????????1????? ??
????(2)????????????????1????n ?????????????????n-1????????????????????鷵????????????????μ??????
??????????
????[html] view plaincopyprint?
????import javax.swing.JOptionPane;
????/*
????* time:2012.12.2
????* author:??????
????* description:
????*/
????public class Hanoi {
????private final static String from = "????B";
????private final static String to = "????C";
????private final static String mid = "????A";
????public static void main(String[] args) {
????String input = JOptionPane.showInputDialog("????????????????????");
????int num = Integer.parseInt(input);
????Hanoi.move(num?? from?? mid?? to);
????}
????private static void move(int num?? String from2?? String mid2?? String to2) {
????if (num == 1) {
????System.out.println("???????1 ??" + from2 + "??" + to2);
????} else {
????move(num - 1?? from2?? to2?? mid2);
????System.out.println("???????" + num + " ??" + from2 + "??" + to2);
????move(num - 1?? mid2?? from2?? to2);
????}
????}
????}
????import javax.swing.JOptionPane;
????/*
????* time:2012.12.2
????* author:??????
????* description:
????*/
????public class Hanoi {
????private final static String from = "????B";
????private final static String to = "????C";
????private final static String mid = "????A";
????public static void main(String[] args) {
????String input = JOptionPane.showInputDialog("????????????????????");
????int num = Integer.parseInt(input);
????Hanoi.move(num?? from?? mid?? to);
????}
????private static void move(int num?? String from2?? String mid2?? String to2) {
????if (num == 1) {
????System.out.println("???????1 ??" + from2 + "??" + to2);
????} else {
????move(num - 1?? from2?? to2?? mid2);
????System.out.println("???????" + num + " ??" + from2 + "??" + to2);
????move(num - 1?? mid2?? from2?? to2);
????}
????}
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11