题解 | 走方格的方案数
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
import math import sys n,m = map(int,sys.stdin.readline().strip().split()) # 一共需要走n个右和m个下,只是顺序不同,所以就是组合 print(math.comb((n+m),n)) # print(math.comb((n+m),m))也行
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
import math import sys n,m = map(int,sys.stdin.readline().strip().split()) # 一共需要走n个右和m个下,只是顺序不同,所以就是组合 print(math.comb((n+m),n)) # print(math.comb((n+m),m))也行
相关推荐