You are viewing a single comment's thread. Return to all comments →
JS solution using cayley's formula...
function beadOrnaments(b) { let ans = b.reduce((ans, a) => ans * BigInt(a) ** (BigInt(a) - 1n), 1n) let sum = b.reduce((sum, a) => sum + BigInt(a), 0n) if (b.length - 2 >= 0) { ans *= sum ** BigInt(b.length - 2) } else { ans /= sum } return ans % 1000000007n }
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 →
JS solution using cayley's formula...