Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试解决给出源网格坐标和结束网格坐标的问题。我必须计算从源网格到结束网格的所有可能路径。我应该使用什么算法?
您需要执行N + M步骤,N其中的步骤是向下的,M其中的步骤是正确的。
N + M
N
M
有多种C(N+M, N)变体可以制作此路径,其中C()是组合数
C(N+M, N)
C()
假设你的终点坐标从你的源坐标向下 m 步和 n 步,这不是可能的路径数 (m+n)Cn 吗?如果您想使用现代编程语言绘制路径,那就另当别论了。