n=10
塔1->塔3
herrDeng網內搜尋
自訂搜尋
Ads
2011年12月1日 星期四
訂閱:
張貼留言 (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 C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
50 則留言:
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
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);
}
}
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);
}
}
張貼留言