#abc214c. C - Distribution
C - Distribution
Score : points
问题描述
有 个生物以逆时针顺序站在一个圆圈中,依次称为 Snuke 1, 2, ..., N。
当 Snuke ()在时间 收到一颗宝石时,经过 单位时间后,它会在时间 将这颗宝石传递给顺时针方向的下一个生物 Snuke 。这里需要注意的是,Snuke 实际上是指 Snuke 1。
另外,Takahashi 将在时间 向 Snuke 传递一颗宝石。
对于每个 (),请找出 Snuke 第一次收到宝石的时间。假设传递宝石所需的时间可以忽略不计。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are creatures standing in a circle, called Snuke in counter-clockwise order.
When Snuke receives a gem at time , units of time later, it will hand that gem to Snuke at time . Here, Snuke is Snuke .
Additionally, Takahashi will hand a gem to Snuke at time .
For each , find the time when Snuke receives a gem for the first time. Assume that it takes a negligible time to hand a gem.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the time when Snuke receives a gem for the first time.
Sample Input 1
3
4 1 5
3 10 100
Sample Output 1
3
7
8
We will list the three Snuke's and Takahashi's actions up to time in chronological order.
Time : Takahashi hands a gem to Snuke .
Time : Snuke hands a gem to Snuke .
Time : Snuke hands a gem to Snuke .
Time : Takahashi hands a gem to Snuke .
Time : Snuke hands a gem to Snuke .
Time : Snuke hands a gem to Snuke .
After that, they will continue handing gems, though it will be irrelevant to the answer.
Sample Input 2
4
100 100 100 100
1 1 1 1
Sample Output 2
1
1
1
1
Note that the values and may not be distinct.
Sample Input 3
4
1 2 3 4
1 2 4 7
Sample Output 3
1
2
4
7
Note that a Snuke may perform multiple transactions simultaneously. Particularly, a Snuke may receive gems simultaneously from Takahashi and another Snuke.
Sample Input 4
8
84 87 78 16 94 36 87 93
50 22 63 28 91 60 64 27
Sample Output 4
50
22
63
28
44
60
64
27
update @ 2024/3/10 09:31:19