Movatterモバイル変換


[0]ホーム

URL:


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

修正卡码网0095.城市间货物运输II中,Python解决SPFA方法求解含有负回路的最短路问题的错误#2964

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
lthero-big wants to merge1 commit intoyoungyangyang04:master
base:master
Choose a base branch
Loading
fromlthero-big:master

Conversation

lthero-big
Copy link

修正卡码网0095.城市间货物运输II中,Python解决SPFA方法求解含有负回路的最短路问题的错误

原代码(错误的)

                count[next_node] += 1                if next_node not in d:                      d.append(next_node)

在输入例子

4 61 4 31 2 11 3 13 2 -22 4 13 4 0

会输出circle,但正确结果是0

纠正代码(可以通过全部例子)

                if next_node not in d:                      count[next_node] += 1                      d.append(next_node)

修正卡码网0095.城市间货物运输II中,Python解决SPFA方法求解含有负回路的最短路问题的错误count[next_node] += 1应该在 if next_node not in d: 语句块内
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@lthero-big

[8]ページ先頭

©2009-2025 Movatter.jp