#abc340e. E - Mancala 2
E - Mancala 2
Score: points
问题描述
有 个编号为 到 的箱子。最初,第 个箱子里包含 个球。
Takahashi 将按照以下顺序对 执行以下操作:
- 将变量 设置为 。
- 从第 个箱子里取出所有球并握在手中。
- 当手中至少持有一个球时,重复以下过程:
- 将 的值增加 。
- 将手中的一颗球放入编号为 的箱子中。
确定完成所有操作后每个箱子里的球的数量。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are boxes numbered to . Initially, box contains balls.
Takahashi will perform the following operations for in order:
- Set a variable to .
- Take out all the balls from box and hold them in hand.
- While holding at least one ball in hand, repeat the following process:
- Increase the value of by .
- Put one ball from hand into box .
Determine the number of balls in each box after completing all operations.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Let be the number of balls in box after completing all operations. Print in this order, separated by spaces.
Sample Input 1
5 3
1 2 3 4 5
2 4 0
Sample Output 1
0 4 2 7 2
The operations proceed as follows:
Sample Input 2
3 10
1000000000 1000000000 1000000000
0 1 0 1 0 1 0 1 0 1
Sample Output 2
104320141 45436840 2850243019
Sample Input 3
1 4
1
0 0 0 0
Sample Output 3
1
update @ 2024/3/10 01:33:15