網頁

2015年12月1日 星期二

ex6 河內塔

河內塔

66 則留言:

  1. B10333107-曾詠浩2015年12月1日 下午3:40

    package b10333107;

    public class hw1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3){ if(n ==1) System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); else { hanoiTower(n-1, p1, p2, p3); System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); hanoiTower(n-1, p1, p2, p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); }}

    回覆刪除
  2. B10333070 徐承瑋2015年12月1日 下午3:42



    public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  3. B10333104郭杰哲2015年12月1日 下午3:43


    public class text_1 { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3) { if(n==1) System.out.println((++count)+":Dick "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p2,p3); System.out.println((++count)+":Dick "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p1,p2,p3); } }
    public static void main(String[] args) { // TODO Auto-generated method stub hanoiTower(4,1,2,3);
    }
    }

    回覆刪除
  4. B10333061陳柏諺2015年12月1日 下午3:44

    package hw1;

    public class p1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  5. B10333082吳樹凱2015年12月1日 下午3:44

    package hw1;

    public class p1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除

  6. public class ex1 {
    static int count=0;
    static void hanoiTower(int n, int p1, int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    }
    }
    public static void main(String[] args) {
    hanoiTower(4,1,2,3);


    }

    }

    回覆刪除
  7. B10333106劉郁芃2015年12月1日 下午3:45

    public class ex1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3); }

    }

    回覆刪除
  8. B10333086 陳晏堂2015年12月1日 下午3:46

    package w1;
    public class w1 {
    static int count=0;
    static void hanoiTower(int n,int p1,int p2,int p3)
    {
    if(n==1)
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    hanoiTower(n-1,p2,p1,p3);
    }
    }

    public static void main(String[] args) {
    hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  9. public class ex1{ static int count=0; static void hanoiTower(int n,int p1, int p2,int p3) { if(n==1) System.out.println((++count)+":Disk"+"form"+p1+"to"+p3 ); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+"form"+p1+"to"+p3 ); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args){ hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  10. B10333086 陳晏堂2015年12月1日 下午3:46

    package w1;
    public class w1 {
    static int count=0;
    static void hanoiTower(int n,int p1,int p2,int p3)
    {
    if(n==1)
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    hanoiTower(n-1,p2,p1,p3);
    }
    }

    public static void main(String[] args) {
    hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  11. B10236116 許誌文2015年12月1日 下午3:46

    public class ex1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else { hanoiTower(n-1 , p1, p3, p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); hanoiTower(n-1, p2, p1, p3); } }

    public static void main(String[] args) { hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  12. B10333083,周琬芸2015年12月1日 下午3:46

    public class ex1{ static int count=0; static void hanoiTower(int n,int p1, int p2,int p3) { if(n==1) System.out.println((++count)+":Disk"+"form"+p1+"to"+p3 ); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+"form"+p1+"to"+p3 ); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args){ hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  13. b10333102三于婷2015年12月1日 下午3:46

    public class hw1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  14. B10333107-曾詠浩 (訂正版)2015年12月1日 下午3:47

    package b10333107; public class hw1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3) { if(n ==1) System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); else { hanoiTower(n-1, p1, p3, p2); System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); hanoiTower(n-1, p2, p1, p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3); } }

    回覆刪除

  15. public class ex1 {
    static int count=0;
    static void hanoiTower(int n, int p1, int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    }
    }
    public static void main(String[] args) {
    hanoiTower(4,1,2,3);


    }

    }

    回覆刪除
  16. B10333066周政霆2015年12月1日 下午3:48

    public class ex1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3); }

    }

    回覆刪除


  17. public class hanoitower { static int count=0; static void hanoitower(int n,int p1,int p2,int p3){ if (n==1) System.out.println((++count)+":"+n+"從"+p1+"到"+p3); else { hanoitower(n-1,p1,p3,p2); System.out.println((++count)+":"+n+"從"+p1+"到"+p3); hanoitower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoitower(4,1,2,3);

    }

    }

    回覆刪除
  18. public class ex1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk"+n+" from"+p1+" to "+p3); else { hanoiTower(n-1,p1,p3, p2); System.out.println((++count)+":Disk"+n+" from "+p1+" to "+p3); hanoiTower(n-1,p2,p1, p3); } }

    public static void main(String[] args) { // TODO Auto-generated method stub hanoiTower(4, 1, 2, 3); }

    }

    回覆刪除
  19. B10333089游智翔2015年12月1日 下午3:50

    package p1;

    public class hw1 {
    static int count=0;
    static void hanoiTower(int n , int p1 ,int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3);
    else
    {
    hanoiTower(n-1,p1,p2,p3);
    System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3);
    hanoiTower(n-1,p1,p2,p3);
    }
    }
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  20. package b10333079;

    public class ex1 {static int count=0;static void xxx(int n , int p1 , int p2 , int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { xxx(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); xxx(n-1,p2,p1,p3); }} public static void main(String[] args) { xxx(4,1,2,3);

    }

    }

    回覆刪除
  21. b10333094張之銜2015年12月1日 下午3:50

    package p1; public class hw1 { static int count=0; static void yyy(int n, int p1, int p2, int p3) { if(n==1) System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); else { yyy(n-1, p1, p3, p2); System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); yyy(n-1,p2,p1, p3); } } public static void main(String[] args) { // TODO Auto-generated method stub yyy(4,1,2,3); }

    }

    回覆刪除
  22. b10333079 葉禮魁2015年12月1日 下午3:51

    package b10333079;

    public class ex1 {static int count=0;static void xxx(int n , int p1 , int p2 , int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { xxx(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); xxx(n-1,p2,p1,p3); }} public static void main(String[] args) { xxx(4,1,2,3);

    }

    }

    回覆刪除
  23. B10333055翁恩義2015年12月1日 下午3:51

    public class ex1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else { hanoiTower(n-1, p1, p3, p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); hanoiTower(n-1, p2, p1, p3); } } public static void main(String[] args) { hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  24. public class EX1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk " +n+ " from "+p1+" to "+p3); else { hanoiTower(n-1, p1 , p3 , p2); System.out.println((++count)+":Disk " +n+ " from "+p1+" to "+p3); hanoiTower(n-1, p2 , p1 , p3); } }
    public static void main(String[] args) { hanoiTower(4 , 1 , 2 , 3);
    }
    }

    回覆刪除
  25. B10333072黃玟茜_資管二乙2015年12月1日 下午3:52

    package hw2;

    public class p1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  26. B10333087 蔡銘家2015年12月1日 下午3:52

    package hw1;public class ex1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+"from"+p1+" to "+p3); else { hanoiTower(n-1, p1, p3, p2); System.out.println((++count)+":Disk "+n+"from"+p1+" to "+p3); hanoiTower(n-1, p2, p1, p3); } } public static void main(String[] args) { hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  27. B10333058黃永祥2015年12月1日 下午3:52



    public class ex1 {static int count=0;static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else {hanoiTower(n-1, p2, p1, p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3);hanoiTower(n-1, p2, p1, p3);}}public static void main(String[] args) { hanoiTower(4, 1, 2, 3);}}

    回覆刪除
  28. B10333097胡聖恩2015年12月1日 下午3:53



    public class ex1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3) { if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3); }}

    回覆刪除
  29. B10333092黃星維2015年12月1日 下午3:54



    public class ex1 {static int count=0;static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else {hanoiTower(n-1, p2, p1, p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3);hanoiTower(n-1, p2, p1, p3);}}public static void main(String[] args) { hanoiTower(4, 1, 2, 3);}}

    回覆刪除
  30. package p1;public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish "+n+" From "+t1+" To "+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish "+n+" From "+t1+ " To "+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  31. public class test1 {
    static int count=0;
    static void hanoiTower(int n, int p1,int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3, p2);
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    hanoiTower(n-1,p2,p1, p3);
    }
    }

    public static void main(String[] args) {
    // TODO Auto-generated method stub
    hanoiTower(4,1,2,3);
    }

    }

    回覆刪除
  32. b10333080王育文2015年12月1日 下午3:55

    public class ex1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3) { if(n==1) System.out.println((++count)+":"+"盤"+n+" from "+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":"+"盤"+n+" from "+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  33. B10333090廖偉翔2015年12月1日 下午3:55

    package p;

    public class q {

    static int count=0;static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }}public static void main(String[] args) { hanoiTower(4,1,2,3); }}

    回覆刪除
  34. B10333100李禹範2015年12月1日 下午3:56

    public class W1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3) { if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { // TODO Auto-generated method stub hanoiTower(4,1,2,3); } }

    回覆刪除
  35. b10333063羅胤銓2015年12月1日 下午3:56

    package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub

    }

    }

    回覆刪除
  36. B10333098蔡紹威2015年12月1日 下午3:57



    public class ex1 {static int count=0;static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else {hanoiTower(n-1, p2, p1, p2); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3);hanoiTower(n-1, p2, p1, p3);}}public static void main(String[] args) { hanoiTower(4, 1, 2, 3);}}

    回覆刪除
  37. B10333057楊嘉昀2015年12月1日 下午3:58

    package b10333057;

    public class a1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1, p1 ,p3 ,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1, p2 ,p1 ,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }}

    回覆刪除
  38. B10333077潘家銘2015年12月1日 下午3:58

    package h1;

    public class w1 {

    static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); else { hanoiTower(n-1, p1, p3, p2); System.out.println((++count)+":Disk "+n+" from"+p1+" to "+p3); hanoiTower(n-1, p2, p1, p3); } } public static void main(String[] args) { hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  39. 林羿君B103331092015年12月1日 下午4:25

    package h1;

    public class p1 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1, p1, p3, p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1, p2, p1, p3); } }

    public static void main(String[] args) { hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  40. B10333062邱鐠生2015年12月1日 下午4:27

    package p1;

    public class hw1 { static int count=0; static void hanoiTower(int n , int p1 ,int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); else { hanoiTower(n-1,p1,p2,p3); System.out.println((++count)+":Disk "+n+" from "+p1+" to "+p3); hanoiTower(n-1,p1,p2,p3); } } public static void main(String[] args) { // TODO Auto-generated method stub hanoiTower(4, 1, 2, 3);

    }

    }

    回覆刪除
  41. B10333168 楊君堯2015年12月1日 下午4:28

    public class ex1 {
    static int count=0;
    static void hanoiTower(int n, int p1, int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    }
    }
    public static void main(String[] args) {
    hanoiTower(4,1,2,3);


    }

    }

    回覆刪除
  42. B10333172黃緯豪2015年12月1日 下午4:30

    public class ex1 {
    static int count=0;
    static void hanoiTower(int n, int p1, int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    }
    }
    public static void main(String[] args) {
    hanoiTower(4,1,2,3);


    }

    }

    回覆刪除
  43. B10333168楊君堯2015年12月1日 下午4:34

    public class ex1 {
    static int count=0;
    static void hanoiTower(int n, int p1, int p2, int p3){
    if(n==1)
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+" from"+p1+"to"+p3);
    }
    }
    public static void main(String[] args) {
    hanoiTower(4,1,2,3);


    }

    }

    回覆刪除
  44. 王舒瑄b103330672015年12月1日 下午4:37



    public class P1 {static int count=0;static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1)System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); }

    }

    回覆刪除
  45. package p1;public class test1{ static int count=0;static void hanoiTower(int n ,int p1 ,int p2 ,int p3) { if (n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }}

    public static void main(String[] args) { hanoiTower(4,1,2,3); }

    }

    回覆刪除
  46. B10333108莊祐瑋2015年12月1日 下午4:40



    public class ex1 { static int count=0; static void hanoiTower(int n,int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); } } public static void main(String[] args) { hanoi Tower(4,1,2,3);

    }

    回覆刪除
  47. public class ex1 { static int count=0; static void hanoiTower(int n,int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); } } public static void main(String[] args) { hanoi Tower(4,1,2,3); }

    回覆刪除
  48. B10333075曾敬堯2015年12月1日 下午4:41

    public class text1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3){ if(n==1) System.out.println((++count)+"Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+"Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) {hanoiTower(4,1,2,3);

    }}

    回覆刪除
  49. B10333065 林雨婷2015年12月1日 下午4:42



    public class EX01 {static int count=0;static void hanoiTower(int n, int p1, int p2,int p3){ if(n==1) System.out.println((+count)+":Disk"+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,2);

    }

    }

    回覆刪除
  50. public class W1
    {
    static int count=0;
    static void hanoiTower(int n,int p1,int p2,int p3)
    {
    if(n==1)
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    else
    {
    hanoiTower(n-1,p1,p3,p2);
    System.out.println((++count)+":Disk"+n+"from"+p1+"to"+p3);
    hanoiTower(n-1,p2,p1,p3);
    }
    }
    public static void main(String[] args)
    {
    // TODO Auto-generated method stub
    hanoiTower(4,1,2,3);
    }

    }

    回覆刪除
  51. public class ex1 { static int count=0; static void hanoiTower(int n,int p1,int p2,int p3) { if(n==1) System.out.println((++count)+":"+"盤"+n+" from "+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":"+"盤"+n+" from "+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } } public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  52. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  53. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  54. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  55. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }
    }

    回覆刪除
  56. package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub



    }



    }

    回覆刪除
  57. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  58. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }
    }

    回覆刪除
  59. package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub



    }



    }

    回覆刪除
  60. b10333093 徐子軒2015年12月22日 下午4:10



    package b10333093;

    public class ex4 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  61. package b10333093;

    public class ex4 { static int count=0; static void hanoiTower(int n, int p1, int p2, int p3){ if(n==1) System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk "+n+"from"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); } }

    public static void main(String[] args) { hanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  62. public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }

    public static void main(String[] args) { HanoiTower(4,1,2,3);

    }

    }

    回覆刪除
  63. B10333071廖智加2016年1月5日 下午2:17

    package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub



    }



    }

    回覆刪除
  64. 林羿君 B103331092016年1月5日 下午2:19

    public class hw1 { static int count=0; static void HanoiTower(int n,int t1, int t2, int t3){ if(n==1) System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); else { HanoiTower(n-1,t1,t3,t2); System.out.println((++count)+":Dish"+n+"From"+t1+"To"+t3); HanoiTower(n-1,t2,t1,t3); } }



    public static void main(String[] args) { HanoiTower(4,1,2,3);



    }



    }

    回覆刪除
  65. B10333071廖智加2016年1月5日 下午2:19

    package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub



    }



    }

    回覆刪除
  66. B10333071廖智加2016年1月5日 下午2:20

    package zxc;public class adf { static int count=0; static void hanoiTower(int n, int p1,int p2,int p3){ if(n==1) System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); else { hanoiTower(n-1,p1,p3,p2); System.out.println((++count)+":Disk"+n+"form"+p1+"to"+p3); hanoiTower(n-1,p2,p1,p3); }} public static void main(String[] args) { hanoiTower(4,1,2,3); // TODO Auto-generated method stub



    }



    }

    回覆刪除

HTML 編輯器