From 2fe74f236c46b371d39c4549d82092bd179e61cb Mon Sep 17 00:00:00 2001 From: Your Name <2109724817@qq.com> Date: Sun, 6 Jul 2025 09:31:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A00377.=E7=BB=84=E5=90=88?= =?UTF-8?q?=E6=80=BB=E5=92=8C=E2=85=A3=20C++=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" index ab92f24aef..cba8cae430 100755 --- "a/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" +++ "b/problems/0377.\347\273\204\345\220\210\346\200\273\345\222\214\342\205\243.md" @@ -117,7 +117,8 @@ public: dp[0] = 1; for (int i = 0; i <= target; i++) { // 遍历背包 for (int j = 0; j < nums.size(); j++) { // 遍历物品 - if (i - nums[j] >= 0 && dp[i] < INT_MAX - dp[i - nums[j]]) { + // INT_MAX需取等,以包含leecode所有溢出情况 + if (i - nums[j] >= 0 && dp[i] <= INT_MAX - dp[i - nums[j]]) { dp[i] += dp[i - nums[j]]; } } From e96addcc74c4e605dc9a4d551dc43a1348651119 Mon Sep 17 00:00:00 2001 From: Your Name <2109724817@qq.com> Date: Mon, 21 Jul 2025 11:48:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B90098=E7=9A=84path?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" index c71981996b..42a10179f7 100644 --- "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" @@ -195,7 +195,7 @@ while (m--) { ```CPP vector> result; // 收集符合条件的路径 -vector path; // 0节点到终点的路径 +vector path; // 1节点到终点的路径 // x:目前遍历的节点 // graph:存当前的图 // n:终点 From dbbb6bf60890364bdb3d746fa4af1e3f5f57a44c Mon Sep 17 00:00:00 2001 From: Your Name <2109724817@qq.com> Date: Mon, 21 Jul 2025 12:02:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B90098.=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E8=B7=AF=E5=BE=84=E7=9A=84path=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" index 3640132462..8b0ee9c96c 100644 --- "a/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" +++ "b/problems/kamacoder/0098.\346\211\200\346\234\211\345\217\257\350\276\276\350\267\257\345\276\204.md" @@ -196,7 +196,7 @@ while (m--) { ```CPP vector> result; // 收集符合条件的路径 -vector path; // 1节点到终点的路径 +vector path; // 1节点到终点的路径 // x:目前遍历的节点 // graph:存当前的图 // n:终点