finish level5/disorderly-escape #8

Merged
seongbeom_park merged 6 commits from level5/disorderly-escape into main 2022-03-21 07:37:12 +00:00
Showing only changes of commit 7d237786c0 - Show all commits

View File

@ -9,7 +9,10 @@ def solution(w, h, s):
if c not in memo_sp:
memo_sp[c] = s ** c
cases += memo_sp[c]
return str(cases / (memo_f[w] * memo_f[h]))
result = cases
result /= memo_f[w]
result /= memo_f[h]
return str(result)
def generate_cycle_count(w, h, memo_f = {}):
memo_c = {}
@ -75,7 +78,9 @@ def count_permutation(s, memo_f, memo_p):
for size, freq in group.items():
if freq not in memo_f:
memo_f[freq] = math.factorial(freq)
result /= memo_f[freq] * (size ** freq)
result /= memo_f[freq]
for i in range(freq):
result /= size
memo_p[s] = result
return memo_p[s]