Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process(factors):
- used = set()
- res = 0
- if (len(factors) == 2 and factors[0][1] == factors[1][1] and factors[0][0]*factors[1][0] < 100):
- res += 1
- factors.sort(key=lambda x: -x[1])
- factors += [(0, 0)] * M
- for pair in pairs:
- done = False
- n = 1
- for j in range(len(pair)):
- n *= factors[j][0] ** pair[j]
- if factors[j][1] < pair[j]:
- done = True
- if done or n in used:
- continue
- used.add(n)
- for j in range(len(pair)):
- t = factors[j]
- factors[j] = (t[0], t[1] - pair[j])
- res += 1
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement