mirror of
https://github.com/krahets/hello-algo.git
synced 2026-09-03 21:57:14 +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,20 @@
|
||||
// File: fractional_knapsack_test.go
|
||||
// Created Time: 2023-07-23
|
||||
// Author: Reanon (793584285@qq.com)
|
||||
|
||||
package chapter_greedy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFractionalKnapsack(t *testing.T) {
|
||||
wgt := []int{10, 20, 30, 40, 50}
|
||||
val := []int{50, 120, 150, 210, 240}
|
||||
capacity := 50
|
||||
|
||||
// 貪欲法
|
||||
res := fractionalKnapsack(wgt, val, capacity)
|
||||
fmt.Println("ナップサック容量を超えない最大価値は", res)
|
||||
}
|
||||
Reference in New Issue
Block a user