#P10318. [SHUPC 2024] 彭罗斯水槽
[SHUPC 2024] 彭罗斯水槽
Problem Description
Xiao A had a hallucination in class. He imagined several sinks arranged in a circle, where the water in each sink would flow into the next sink (of course, this is impossible in real life).
So Xiao A started thinking about the following problem:
There are sinks arranged in a circle. Each sink has a capacity, and initially all sinks are full. Then, every second, all the water in sink is transferred to sink (in particular, the water in sink is transferred to sink ). If the transferred water exceeds the capacity, it will overflow.
Now he wants to know, for the next to seconds, the total amount of water in all sinks at each second.
Input Format
The first line contains a positive integer , representing the number of sinks.
The second line contains numbers. The -th number represents the capacity of sink .
Output Format
Output numbers separated by spaces. They represent, for seconds to , the total amount of water in all sinks at each second.
5
3 2 5 4 3
14 12 11 10 10
6
171 814 2313 6676 196 897
3861 1719 1076 1051 1026 1026
Hint
Translated by ChatGPT 5