Skip to content

Instantly share code, notes, and snippets.

@cocodrips
Last active January 2, 2016 23:59
Show Gist options
  • Save cocodrips/8380194 to your computer and use it in GitHub Desktop.
Save cocodrips/8380194 to your computer and use it in GitHub Desktop.
Combinationの総数を計算する
def combination(n, m):
a, b = 1, 1
if m > n / 2:
m = n - m
for i in xrange(m):
a *= n - i
b *= i + 1
return a / b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment