herrDeng網內搜尋

自訂搜尋

Ads

2011年12月1日 星期四

河內塔

n=10
塔1->塔3

50 則留言:

B9933050 提到...

package pack1;

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

B9933050 提到...

package pack1;

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

B9933012 提到...

package p1;

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

B9933050 提到...

package pack1;

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

B9933050 提到...

package pack1;

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

B9933050 提到...

package pack1;

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

B9933010 提到...

package pack1;

public class A1 {

/**
* @param args
*/
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,peg1,peg3,peg2);
}
}
public static void main(String[] args){
int dishs=10;
hanoiTower(dishs,1,2,3);
}


}

B9933017 提到...

public class CH4 {

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 =10;
hanoiTower(dishs, 1,2,3);


}

}

B9933021 提到...

public class CH4 {
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=10;
hanoiTower(dishs, 1,2,3);
}

}

B9933025 提到...

package pack1;

public class t1 {

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=10;
hanoiTower(dishs,1,2,3);
}
}

B9933043 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

B9933004 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

B9933046 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

b9933002 提到...

public class b1 {

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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933045 提到...

public class t2
{
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 n = 10;
hanoiTower(n ,1,2,3);
}

}

B9933040 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

B9933057 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

B9933051 提到...

public class B9933051
{
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=10;
hanoitower(dishs,1,2,3);

}

}

B9933044 提到...

package dddfsfd;

public class dfsfsf {

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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933055 提到...

public class b1 {

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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933043 提到...

package pack1;
import java.util.*;
class A1 {

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=10;
hanoiTower(dishs,1,2,3);





}

}

B9933023 提到...

public class b1 {

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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933024 提到...

public class b1 {

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=10;
hanoiTower(dishs,1,2,3);

}

}

b9933054 提到...

public class b1 {

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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933003 提到...

package pack;

public class pack {
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 = 10;
hanoiTower(dishs, 1,2,3);

}

}

B9933052 提到...

package V1;

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

B9733089 提到...

package pack1;

public class L1 {

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 = 10;
hanoiTower(dishs,1,2,3);


}





}

B9933001 提到...

package V1;

public class V1 {





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,peg1,peg3,peg2);

}

}

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


}

B9933001 提到...

package V1;

public class V1 {





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,peg1,peg3,peg2);

}

}

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


}

B9933014 提到...

public class b1 {
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,peg1,peg3,peg2);
}
}
public static void main(String[] args) {




int dishs=10;
hanoiTower(dishs,1,2,3);
}

}

b9933028 提到...

package P1;

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

}

}

b9933026 提到...

package pack1;

public class A1 {

/**
* @param args
*/
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,peg1,peg3,peg2);
}
}
public static void main(String[] args){
int dishs=10;
hanoiTower(dishs,1,2,3);
}

}

B9933007 提到...

package pack1;

public class A1 {

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,peg1,peg3,peg2);
}
}
public static void main(String[] args){
int dishs=10;
hanoiTower(dishs,1,2,3);
}

}

B9933042 提到...

public class B1 {
static void hnt(int dishs,int peg1,int peg2,int peg3){

if (dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hnt(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hnt(dishs-1,peg2,peg1,peg3);
}
}

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

B9933011 提到...

public class B1 {
static void hnt(int dishs,int peg1,int peg2,int peg3){

if (dishs==1)
System.out.println("盤子從"+peg1+"移到"+peg3);
else{
hnt(dishs-1,peg1,peg3,peg2);
System.out.println("盤子從"+peg1+"移到"+peg3);
hnt(dishs-1,peg2,peg1,peg3);
}
}

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

B9933014 提到...

import java.io.*;
public class b1 {
public static void hanoi(int n, char f, char u, char t)
{
if (n == 1)
{
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+ t);
}
else
{
hanoi(n-1,f,t,u);
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+t);
hanoi(n-1,u,f,t);
}
}








public static void main(String[] args) throws IOException
{
int i,k;
char f='A',u='B',t='C';
BufferedReader kb=new BufferedReader(new InputStreamReader(System.in));
String x;

System.out.println("河內塔小遊戲=========\n");
System.out.print("請輸入盤子數量:\t");

x=kb.readLine(); k=Integer.parseInt(x); hanoi(k,f,u,t);
}
}

B9933015 提到...

import java.io.*;
public class X1 {
public static void hanoi(int n, char f, char u, char t)
{
if (n == 1)
{
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+ t);
}
else
{
hanoi(n-1,f,t,u);
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+t);
hanoi(n-1,u,f,t);
}
}
public static void main(String[] args) throws IOException
{
int i,k;
char f='A',u='B',t='C';
BufferedReader kb=new BufferedReader(new InputStreamReader(System.in));
String x;

System.out.println("河內塔小遊戲=========\n");
System.out.print("請輸入盤子數量:\t");

x=kb.readLine(); k=Integer.parseInt(x); hanoi(k,f,u,t);
}
}

b9733054 提到...

public class b9733054 {
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) {
// TODO Auto-generated method stub
int dishs=10;
hanoiTower(dishs,1,2,3);
}

}

B9933049 提到...

package P1;
import java.io.*;
public class A1
{
public static void hanoi(int n, char f, char u, char t)
{
if (n == 1)
{
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+ t);
}
else
{
hanoi(n-1,f,t,u);
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+t);
hanoi(n-1,u,f,t);
}
}

public static void main(String[] args) throws IOException
{
int i,k;
char f='A',u='B',t='C';
BufferedReader kb=new BufferedReader(new InputStreamReader(System.in));
String x;

System.out.println("河內塔小遊戲=========\n");
System.out.print("請輸入盤子數量:\t");

x=kb.readLine(); k=Integer.parseInt(x); hanoi(k,f,u,t);
}
}

b9933005豐智偉 提到...

package P1;
import java.io.*;
public class A {


public 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 =10;
hanoiTower(dish,1,2,3);
}
}

b9933056 提到...

package fg;
import java.io.*;
public class gfhf
{
public static void hanoi(int n, char f, char u, char t)
{
if (n == 1)
{
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+ t);
}
else
{
hanoi(n-1,f,t,u);
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+t);
hanoi(n-1,u,f,t);
}
}

public static void main(String[] args) throws IOException
{
int i,k;
char f='A',u='B',t='C';
BufferedReader kb=new BufferedReader(new InputStreamReader(System.in));
String x;

System.out.println("河內塔小遊戲=========\n");
System.out.print("請輸入盤子數量:\t");

x=kb.readLine(); k=Integer.parseInt(x); hanoi(k,f,u,t);
}
}

B9933036 提到...

package fg;
import java.io.*;
public class gfhf
{
public static void hanoi(int n, char f, char u, char t)
{
if (n == 1)
{
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+ t);
}
else
{
hanoi(n-1,f,t,u);
System.out.println(" Dish "+ n +"\t從 "+ f +" 搬移到 "+t);
hanoi(n-1,u,f,t);
}
}

public static void main(String[] args) throws IOException
{
int i,k;
char f='A',u='B',t='C';
BufferedReader kb=new BufferedReader(new InputStreamReader(System.in));
String x;

System.out.println("河內塔小遊戲=========\n");
System.out.print("請輸入盤子數量:\t");

x=kb.readLine(); k=Integer.parseInt(x); hanoi(k,f,u,t);
}
}

B9933038 提到...

package p1;

public class V1 {
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=10;
hanoiTower(dishs,1,2,3);

}

}

B9933013 提到...

package p1;

public class V1 {
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=10;
hanoiTower(dishs,1,2,3);

}

}

b9933019 提到...

public class b123 {
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=10;
hanoiTower(dishs, 1, 2, 3);


}

}

b9933053 提到...

public class b123 {
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=10;
hanoiTower(dishs, 1, 2, 3);


}

}

B9933008 提到...

package pack1;

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

B9933006 提到...

public class B9933006
{
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=10;
hanoitower(dishs,1,2,3);

}

Z1001012 提到...

package pack1;

public class t1 {

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=10;
hanoiTower(dishs,1,2,3);
}
}

Z1001012 提到...

package pack1;

public class t1 {

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=10;
hanoiTower(dishs,1,2,3);
}
}

Related Posts Plugin for WordPress, Blogger...

熱門文章