3600.Candies

Time Limit: 1s Memory Limit: 256MB

Polycarpus has got n candies and m friends (n \ge m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equal) manner. He wants to choose such ai, where ai is the number of candies in the i-th friend's present, that the maximum ai differs from the least ai as little as possible.

For example, if n is divisible by m, then he is going to present the same number of candies to all his friends, that is, the maximum ai won't differ from the minimum one.

Input Format(From the terminal/stdin)

The single line of the input contains a pair of space-separated positive integers n, m (1 \le n,m \le 100;n \ge m) - the number of candies and the number of Polycarpus's friends.

Output Format(To the terminal/stdout)

Print the required sequence a1,a2,...,am, where ai is the number of candies in the i-th friend's present. All numbers ai must be positive integers, total up to n, the maximum one should differ from the minimum one by the smallest possible value.

Sample Input 1

Copy
12 3
  · \n

Sample Output 1

Copy
4 4 4 
 · · \n

Sample Input 2

Copy
15 4
  · \n

Sample Output 2

Copy
3 4 4 4 
 · · · \n

Sample Input 3

Copy
18 7
  · \n

Sample Output 3

Copy
2 2 2 3 3 3 3 
 · · · · · · \n

Hints

Print ai in any order, separate the numbers by spaces.

Submit

请先 登录

© 2025 FAQs