Guest User

Untitled

a guest
Nov 17th, 2019
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def process(factors):
  2.     used = set()
  3.     res = 0
  4.     if (len(factors) == 2 and factors[0][1] == factors[1][1] and factors[0][0]*factors[1][0] < 100):
  5.         res += 1
  6.     factors.sort(key=lambda x: -x[1])
  7.     factors += [(0, 0)] * M
  8.  
  9.  
  10.     for pair in pairs:
  11.         done = False
  12.         n = 1
  13.         for j in range(len(pair)):
  14.             n *= factors[j][0] ** pair[j]
  15.             if factors[j][1] < pair[j]:
  16.                 done = True
  17.         if done or n in used:
  18.             continue
  19.         used.add(n)
  20.         for j in range(len(pair)):
  21.             t = factors[j]
  22.             factors[j] = (t[0], t[1] - pair[j])
  23.         res += 1
  24.     return res
RAW Paste Data