Using Burnside lemma

Need to implement counting the cycles for each combination

* Reference: https://youtu.be/D0d9bYZ_qDY
This commit is contained in:
Seongbeom Park 2022-03-20 07:38:10 +09:00
parent cabc99ce39
commit c4efc8d7d1

View File

@ -1,9 +1,22 @@
import math
def solution(w, h, s):
return '0'
return str(sum([s**cycle for cycle in generate_cycles(w, h)])/(math.factorial(w)*math.factorial(h)))
def generate_cycles(w, h):
yield 1
tests = [
([2, 3, 4], '430'),
([2, 2, 2], '7'),
([1, 1, 2], '2'),
([1, 1, 3], '3'),
([2, 1, 2], '3'),
([1, 2, 2], '3'),
([3, 1, 2], '4'),
([1, 3, 2], '4'),
([2, 3, 2], '13'),
]
for i, o in tests: