herrDeng網內搜尋

自訂搜尋

Ads

2012年11月26日 星期一

河內塔程式

河內塔程式

68 則留言:

B10033052劉悅旻 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033027黃盈嘉 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2, int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg3,peg1);
}
}
public static void main (String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033005 提到...

package p1;


import java.util.*;
public class aa
{


static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);


else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}



public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033003鍾明修 提到...

package p1;
import java.util.*;
public class hw1
{
static void HT(int d,int p1,int p2,int p3)
{
if(d==1)
System.out.println("盤子從"+p1+"移到"+p3);
else
{
HT(d-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移到"+p3);
HT(d-1,p2,p1,p3);
}
}
public static void main(String[]args)
{
Scanner sc=new Scanner(System.in);
int d=sc.nextInt();
HT(d,1,2,3);
}
}

B10033057 李長勳 提到...

import java.util.*;

public class b10033057 {
static void hanoiTower(int dish,int peg1,int peg2,int peg3)
{
if (dish ==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dish-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dish=1,peg2,peg1,peg3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);
}
}

B10033020莊家維 提到...

import java.util.*;
public class B10033020
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033045林仲仁 提到...

import java.util.*;
public class B10033045
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);
}
}

B10033037徐瑜駿 提到...

public class koo {
static void hanoiTower(int dish, int peg1, int peg2, int peg3){
if ( dish == 1)
System.out.println("盤子從 "+peg1+"移到 "+peg3);
else {
hanoiTower(dish-1,peg1,peg3,peg2);
System.out.println("盤子從 "+peg1+"移到 "+peg3);
hanoiTower(dish-1,peg2,peg1,peg3);
}
}
public static void main(String[] args){
int dish = 3;
hanoiTower(dish, 1, 2, 3);
}
}

B10033044陳威宏 提到...


import java.util.*;
public class B10033044
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

b10033014鄧宇純 提到...

public class java {
static void hanoiTower(int dishs, int peg1,int peg2,int peg3){
if (dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);

}
}

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

B10033021簡良宇 提到...


public class Java {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main (String[] args){
int dish =3;
hanoiTower(dish,1,2,3);
}
}

b9813129林峻葦 提到...

public class test
{
static int count=0;

public static void main(String[] args )
{
towerofHanoi (20,'A','B','C');
System.out.println ("The tatal number of steps is" +count);
}
static void towerofHanoi ( int dishes,char from,char by,char to)
{
if(dishes==1)
{
System.out.print (" 盤子從 "+from);
System.out.println (" 移到 "+to);
count++;
}
else
{
towerofHanoi (dishes-1,from,to,by);
System.out.print (" 盤子從 "+from);
System.out.println (" 移到 "+to);
count++;
towerofHanoi ( dishes-1,by,from,to);
}
}
}

b10033039鄭明杰 提到...


public class hekko {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs=3;
hanoiTower(dishs,1,2,3);
}
}

b10033016許竣翔 提到...


public class b16 {
static void hanoiTower (int dishs, int peg1,
int peg2, int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else {
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到 "+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[] args) {
int dishs=3;
hanoiTower(dishs,1,2,3);
}

}

匿名 提到...

B9733002鍾志捷
public class Java {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main (String[] args){
int dish =3;
hanoiTower(dish,1,2,3);
}
}

B10033025林煒翔 提到...

public class yano {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("把盤子從"+peg1+"移至"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("把盤子從"+peg1+"移至"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs=3;
hanoiTower(dishs,1,2,3);
}
}

B10033004 羅時侒 提到...

import java.util.*;
public class B10033004
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033056 陳信吉 提到...

import java.util.*;
public class B10033056
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033015 提到...

import java.util.*;
public class test
{


static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);


else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}



public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033010 賴韋任 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2, int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg3,peg1);
}
}
public static void main (String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033022梁朝富 提到...

public class hello {
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[] args) {
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033035陳雅婷 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033030姜欣宜 提到...

public class aa {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs=3;
hanoiTower(dishs,1,2,3);
}
}

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

B10033048劉雅琪 提到...

public class h{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

b9833084 王綱 提到...

import java.util.*;

public class B9833084
{
static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);
else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);
}
}

b10033009沈哲彣 提到...

import java.util.*;

public class b10033009 {
static void hanoiTower(int dish,int peg1,int peg2,int peg3)
{
if (dish ==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dish-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dish=1,peg2,peg1,peg3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);
}

B10033007 蕭雅文 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B9833091陳孟偉 提到...

public class NYPD{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033019 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033046徐紹桓 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033026姜禮銘 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B9833035 提到...

import java.util.*;
public class B10033035{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033041陳奕綺 提到...

public class koo {
static void hanoiTower(int dish, int peg1, int peg2, int peg3){
if ( dish == 1)
System.out.println("盤子從 "+peg1+"移到 "+peg3);
else {
hanoiTower(dish-1,peg1,peg3,peg2);
System.out.println("盤子從 "+peg1+"移到 "+peg3);
hanoiTower(dish-1,peg2,peg1,peg3);
}
}
public static void main(String[] args){
int dish = 3;
hanoiTower(dish, 1, 2, 3);
}
}

B10033007 蕭雅文 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

b9833151鄭宜青 提到...

import java.util.*;
public class B9833151
{
static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子"+p1+"移動到"+p3);
else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);
}
}

B10033006莊松霖 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033013王彥哲 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033007 蕭雅文 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033012 提到...

public class b16 {
static void hanoiTower (int dishs, int peg1,
int peg2, int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else {
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到 "+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[] args) {
int dishs=3;
hanoiTower(dishs,1,2,3);
}

}

B10033012 廖經泓 提到...

public class hekko {
static void hanoiTower(int dishs,int peg1,int peg2,int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs=3;
hanoiTower(dishs,1,2,3);
}
}

B10033054鄭仲軒 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

b10033049林昌輝 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033018張家忠 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033011邵怡青 提到...

package p1;

import java.util.*;
public class shao
{

private static Scanner sc;

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
sc = new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}
}

B10033031游筑雅 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033034 陳冠錚 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033050張恩慈 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033036邱筱婷 提到...

package p1;

import java.util.*;
public class hi123
{

private static Scanner sc;

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
sc = new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}
}

B10033043 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033002卓孟杰 提到...

public class jas{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

匿名 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033040陳姵儒 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B9833108王冠傑 提到...

public class koo {
static void hanoiTower(int dish, int peg1, int peg2, int peg3){
if ( dish == 1)
System.out.println("盤子從 "+peg1+"移到 "+peg3);
else {
hanoiTower(dish-1,peg1,peg3,peg2);
System.out.println("盤子從 "+peg1+"移到 "+peg3);
hanoiTower(dish-1,peg2,peg1,peg3);
}
}
public static void main(String[] args){
int dish = 3;
hanoiTower(dish, 1, 2, 3);
}
}



B10033032夏瑋駿 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2, int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg3,peg1);
}
}
public static void main (String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033017鄭人豪 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033043史家郡 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033043史家郡 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033018張家忠 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033031游筑雅 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033042 提到...

public class java {
static void hanoiTower(int dishs, int peg1,int peg2,int peg3){
if (dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);

}
}

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

B10033051 羅宏彬 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2, int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg3,peg1);
}
}
public static void main (String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033047 黃鈺翔 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033038邵彥銘 提到...

public class abc {
static void hanoiTower (int dishs, int peg1,
int peg2, int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else {
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到 "+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[] args) {
int dishs=3;
hanoiTower(dishs,1,2,3);
}

}

B10033029王德全 提到...

public class b10033029 {
static void hanoiTower (int dishs, int peg1,
int peg2, int peg3){
if(dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else {
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到 "+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[] args) {
int dishs=3;
hanoiTower(dishs,1,2,3);
}

}

b10033040陳姵儒 提到...

import java.util.*;
public class B10033040
{

static void hanoiTower(int dishs,int p1,int p2,int p3)
{
if (dishs==1)
System.out.println("盤子從"+p1+"移動到"+p3);

else{
hanoiTower(dishs-1,p1,p3,p2);
System.out.println("盤子從"+p1+"移動到"+p3);
hanoiTower(dishs-1,p2,p1,p3);
}
}

public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("請輸入盤數:");
int dishs=sc.nextInt();
hanoiTower(dishs,1,2,3);

}

}

B10033028 劉名翔 提到...

B10033028 劉名翔

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2, int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg3,peg1);
}
}
public static void main (String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

B10033023賴佳汝 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

b10033053吳貴仁 提到...

public class hello{
static void hanoiTower (int dishs, int peg1, int peg2,int peg3){
if(dishs == 1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hanoiTower(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hanoiTower(dishs-1,peg2,peg1,peg3);
}
}
public static void main(String[]args){
int dishs = 3;
hanoiTower(dishs,1,2,3);
}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章