You are viewing a single comment's thread. Return to all comments →
Solution without math namespace, Python3:
def solve(n, m): result = 1 a = min(m-1, n) b = max(m-1, n) for i in range(1, b + 1): result *= (a + i) for j in range(1, b + 1): result //= j return result % (10**9 + 7)
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Permutations
You are viewing a single comment's thread. Return to all comments →
Solution without math namespace, Python3: