You are viewing a single comment's thread. Return to all comments →
pyth 3 omptimized code: from functools import reduce from operator import mul
def beadOrnaments(b): return int((reduce(mul, (x ** (x - 1) for x in b), 1) * (sum(b) ** (len(b) - 2))) % (10 ** 9 + 7))
Seems like cookies are disabled on this browser, please enable them to open this website
Bead Ornaments
You are viewing a single comment's thread. Return to all comments →
pyth 3 omptimized code: from functools import reduce from operator import mul
def beadOrnaments(b): return int((reduce(mul, (x ** (x - 1) for x in b), 1) * (sum(b) ** (len(b) - 2))) % (10 ** 9 + 7))