Dice simulator

This commit is contained in:
Jan-Niclas Loosen
2025-10-24 20:58:31 +02:00
parent 49438ccaaf
commit 90ce78f17d
9 changed files with 312 additions and 6 deletions

View File

@@ -0,0 +1,14 @@
import math
def decomp(x: int, base: list[int]) -> dict[int, int]:
base = sorted(base, reverse=True)
coef = {}
for b in base:
c = math.floor(x / b)
coef[b] = c
x -= b * c
return coef
print(decomp(25, [1, 5, 10, 25]))