herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你的BMI
-
1. 利用遞迴input n算2^n 2. 用C算GCD(3333,456)
-
請用 C/C++/java寫一簡易程式
-
需要練習的Java程式:
-
BMI (Body Mass Index)= 體重 (kg) / 身高 ^2(m 2 ) 在台灣,行政院衛生署乃根據其相關研究,於2002年4月公佈台灣成人肥胖標準: BMI<18.5 為過輕, 18.5≦BMI<24 為正常體重, 24≦BMI<27 為過重, BM...
-
33, 45, 87, 99, 27 算平均
-
一、 試利用switch case由程式中直接輸入一個1~7 之間的整數day,代表星期一到星期日。若day 的值是1,則印出 "星期一",若day 的值是2,則印出 "星期二",若day 的值是7,則印出 "星期日",...
-
用 C/C++算上學期加權平均
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);
}
}
張貼留言