Advertisement
R1bell

Sochitanie

Jan 23rd, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. def next_choose(c, N, k):
  2.     if len(c) < k:
  3.         c.clear()
  4.         c.extend(range(k))
  5.         return tuple(range(k))
  6.     else:
  7.         l = list(c)
  8.         l.extend([N, 0])
  9.     j = 0
  10.     while l[j] + 1 == l[j + 1]:
  11.         c[j] = j
  12.         j += 1
  13.     if j == k:
  14.         return None
  15.     c[j] += 1
  16.     return tuple(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement