fork(1) download
  1. count = 0
  2.  
  3. def choose(n,k):
  4. global count
  5. count += 1
  6. if k <= 0:
  7. return 1
  8. elif n < k:
  9. return 0
  10. else:
  11. return (n + 1 - k)*choose(n, k-1)/k
  12.  
  13. print "answer: ", choose(500,2)
  14. print "function calls: ", count
Success #stdin #stdout 0.01s 7896KB
stdin
Standard input is empty
stdout
answer:  124750
function calls:  3