#K13876. Minimum Rod Cutting Cost

    ID: 24010 Type: Default 1000ms 256MiB

Minimum Rod Cutting Cost

Minimum Rod Cutting Cost

You are given a set of rods. For each rod, you are allowed to cut it into pieces such that every piece has a length not exceeding a given maximum allowed length l. Every cut incurs a fixed cost c. Your task is to determine the minimum total cost required to cut all the rods so that no resulting piece has a length greater than l. Note that if a rod is already less than or equal to l, no cut is needed. When a rod is longer than l, the number of cuts required is computed as \(\left\lfloor \frac{rod - 1}{l} \right\rfloor\), ensuring that you do not perform an extra unnecessary cut if the rod is perfectly divisible by l.

inputFormat

The first line of input contains three space-separated integers: n (the number of rods), l (the maximum allowed length of each piece), and c (the fixed cost per cut).

The second line contains n space-separated integers representing the lengths of the rods.

outputFormat

Output a single integer that represents the minimum total cost required to cut the rods so that every resulting piece has a length not exceeding l.

## sample
3 3 2
9 15 12
18