Update 0494.目标和.md

This commit is contained in:
程序员Carl
2022-07-21 09:37:53 +08:00
committed by GitHub
parent 2d9727d620
commit e108c87570

View File

@ -213,7 +213,7 @@ public:
if (abs(S) > sum) return 0; // 此时没有方案
if ((S + sum) % 2 == 1) return 0; // 此时没有方案
int bagSize = (S + sum) / 2;
if(bagsize<0) return 0;
if (bagsize < 0) return 0;
vector<int> dp(bagSize + 1, 0);
dp[0] = 1;
for (int i = 0; i < nums.size(); i++) {