#K76362. Distribute Cars in Parking Columns

    ID: 34626 Type: Default 1000ms 256MiB

Distribute Cars in Parking Columns

Distribute Cars in Parking Columns

You are given two integers, (n) and (m), which represent the total number of cars and the number of parking columns respectively. Your task is to distribute the (n) cars among the (m) columns such that the difference between the number of cars in any two columns is minimized. In other words, if each column gets a base number of cars (b = \left\lfloor \frac{n}{m} \right\rfloor) and there are (r = n \mod m) extra cars, then the first (r) columns should have (b+1) cars and the remaining columns should have (b) cars. This distribution minimizes the imbalance between columns.

Example: For (n = 7) and (m = 3), we have (b = 2) and (r = 1). Therefore, one possible answer is: [3, 2, 2].

inputFormat

The input consists of a single line containing two space-separated integers: (n) (the number of cars) and (m) (the number of parking columns).

outputFormat

Output a single line containing (m) space-separated integers. The (i)-th integer represents the number of cars parked in the (i)-th column, following the rules described above.## sample

7 3
3 2 2