mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-07 05:04:20 +00:00
772183705e
* Add Russian docs site baseline * Add Russian localized codebase * Polish Russian code wording * Update ru code translation. * Update code translation and chapter covers. * Fix pythontutor extraction. * Add README and landing page. * placeholder of profiles * Use figures of English version * Remove chapter paperbook
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
// File: climbing_stairs_test.go
|
|
// Created Time: 2023-07-18
|
|
// Author: Reanon (793584285@qq.com)
|
|
|
|
package chapter_dynamic_programming
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestClimbingStairsBacktrack(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsBacktrack(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDFS(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDFS(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDFSMem(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDFSMem(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDP(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDP(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsDPComp(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsDPComp(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestClimbingStairsConstraintDP(t *testing.T) {
|
|
n := 9
|
|
res := climbingStairsConstraintDP(n)
|
|
fmt.Printf("Количество способов подняться по лестнице из %d ступеней: %d\n", n, res)
|
|
}
|
|
|
|
func TestMinCostClimbingStairsDPComp(t *testing.T) {
|
|
cost := []int{0, 1, 10, 1, 1, 1, 10, 1, 1, 10, 1}
|
|
fmt.Printf("Список стоимостей ступеней = %v\n", cost)
|
|
|
|
res := minCostClimbingStairsDP(cost)
|
|
fmt.Printf("Минимальная стоимость подъема по лестнице = %d\n", res)
|
|
|
|
res = minCostClimbingStairsDPComp(cost)
|
|
fmt.Printf("Минимальная стоимость подъема по лестнице = %d\n", res)
|
|
}
|