Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. from itertools import combinations_with_replacement
  2. def fillByPowers(s, b, e):
  3. i = 1
  4. while i**e - s - 1 <= b:
  5. i += 1
  6. l = set([sum(c) for c in combinations_with_replacement([a**e for a in range(1, i)], r = s) if sum(c) <= b])
  7. return len(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement