Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import combinations_with_replacement
- def fillByPowers(s, b, e):
- i = 1
- while i**e - s - 1 <= b:
- i += 1
- l = set([sum(c) for c in combinations_with_replacement([a**e for a in range(1, i)], r = s) if sum(c) <= b])
- return len(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement