herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
-
C++ DP動態規劃解Leetcode 937 Maximum Number of Points with Cost 有些標示medium要比標示hard的問題還要難,Leetcode 1937. Maximum Number of Points with Cost,DP動態規...
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);
}
}
張貼留言