mirror of
https://github.com/krahets/hello-algo.git
synced 2026-02-10 14:15:37 +08:00
build
This commit is contained in:
@@ -1531,8 +1531,12 @@ $$
|
||||
int n = coinsSize;
|
||||
int MAX = amt + 1;
|
||||
// 初始化 dp 表
|
||||
int *dp = calloc(amt + 1, sizeof(int));
|
||||
int *dp = malloc((amt + 1) * sizeof(int));
|
||||
for (int j = 1; j <= amt; j++) {
|
||||
dp[j] = MAX;
|
||||
}
|
||||
dp[0] = 0;
|
||||
|
||||
// 状态转移
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int a = 1; a <= amt; a++) {
|
||||
|
||||
Reference in New Issue
Block a user