Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

添加0377.组合总和IV C++ 版本 #2953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
luchefeng wants to merge 5 commits into youngyangyang04:master
base: master
Choose a base branch
Loading
from luchefeng:master
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion problems/0377.组合总和IV.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
}
}
Expand Down
2 changes: 1 addition & 1 deletion problems/kamacoder/0098.所有可达路径.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ while (m--) {

```CPP
vector<vector<int>> result; // 收集符合条件的路径
vector<int> path; // 0节点到终点的路径
vector<int> path; // 1节点到终点的路径
// x:目前遍历的节点
// graph:存当前的图
// n:终点
Expand Down

AltStyle によって変換されたページ (->オリジナル) /