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); } }
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); } }
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); }
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); } }
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); }
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); } }
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); } }
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); } }
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); }
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); }
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); } }
68 則留言:
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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 劉名翔
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);
}
}
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);
}
}
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);
}
}
張貼留言