找到规律,就是排列组合,找不到规律就难了

#画了一下图找到规律就是pCr种走法,跟排列组合是一样的Cpr
from math import factorial as fact
while 1:
    try:
        n,m = [int(x) for x in input().strip().split()]
        p =n+m 
        r =n
        N = fact(p) // (fact(p-r)*fact(r))
        print(N)
    except:
        break