mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-25 11:13:38 +08:00
build
This commit is contained in:
@ -428,12 +428,10 @@ comments: true
|
||||
|
||||
```c title="fractional_knapsack.c"
|
||||
/* 物品 */
|
||||
struct Item {
|
||||
typedef struct {
|
||||
int w; // 物品重量
|
||||
int v; // 物品价值
|
||||
};
|
||||
|
||||
typedef struct Item Item;
|
||||
} Item;
|
||||
|
||||
/* 分数背包:贪心 */
|
||||
float fractionalKnapsack(int wgt[], int val[], int itemCount, int cap) {
|
||||
|
@ -264,7 +264,7 @@ comments: true
|
||||
|
||||
```c title="coin_change_greedy.c"
|
||||
/* 零钱兑换:贪心 */
|
||||
int coinChangeGreedy(int* coins, int size, int amt) {
|
||||
int coinChangeGreedy(int *coins, int size, int amt) {
|
||||
// 假设 coins 列表有序
|
||||
int i = size - 1;
|
||||
int count = 0;
|
||||
|
Reference in New Issue
Block a user