14 lines
260 B
Python
14 lines
260 B
Python
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])) |