mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-29 03:17:13 +00:00
Re-translate the Japanese version (#1871)
* Retranslate Japanese docs with GPT-5.4 * Retranslate Japanese code with GPT-5.4
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// File: hanota_test.go
|
||||
// Created Time: 2023-07-21
|
||||
// Author: hongyun-robot (1836017030@qq.com)
|
||||
|
||||
package chapter_divide_and_conquer
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
. "github.com/krahets/hello-algo/pkg"
|
||||
)
|
||||
|
||||
func TestHanota(t *testing.T) {
|
||||
// リスト末尾が柱の頂上
|
||||
A := list.New()
|
||||
for i := 5; i > 0; i-- {
|
||||
A.PushBack(i)
|
||||
}
|
||||
B := list.New()
|
||||
C := list.New()
|
||||
fmt.Println("初期状態:")
|
||||
fmt.Print("A = ")
|
||||
PrintList(A)
|
||||
fmt.Print("B = ")
|
||||
PrintList(B)
|
||||
fmt.Print("C = ")
|
||||
PrintList(C)
|
||||
|
||||
solveHanota(A, B, C)
|
||||
|
||||
fmt.Println("円盤の移動完了後:")
|
||||
fmt.Print("A = ")
|
||||
PrintList(A)
|
||||
fmt.Print("B = ")
|
||||
PrintList(B)
|
||||
fmt.Print("C = ")
|
||||
PrintList(C)
|
||||
}
|
||||
Reference in New Issue
Block a user