No.1935 Water Simulation
タグ : / 解いたユーザー数 127
作問者 :
noya2
/ テスター :
tatyam
Problem Statement
There are $4$ containers $1,2,3,4$ with capacities $V_1,V_2,V_3,V_4$. Initially, container $1$ contains water of volume $V_1$, and containers $2,3,4$ contain nothing.
Here, operations $1,2,3,4$ are defined as follows.
Find the volume of water in each of containers $1,2,3,4$ after performing $N$ operations in the order of operations $1,2,3,4,1,2,3,4,\dots$.
Constraints
Input
$V_1$ $V_2$ $V_3$ $V_4$ $N$
Output
Find the volume of water in each of containers $1,2,3,4$ after performing the $N$ operations, and print them in this order, separated by spaces.
Sample
Sample 1
Input
2 3 1 2 5
Output
0 2 0 0
Let $(v_1,v_2,v_3,v_4)$ denote the volumes of water in containers $1,2,3,4$.
Initially the state is $(2,0,0,0)$, and after each operation it changes as $(0,2,0,0)\rightarrow (0,1,1,0)\rightarrow (0,1,0,1)\rightarrow (1,1,0,0) \rightarrow (0,2,0,0)$. After $5$ operations the state is $(0,2,0,0)$, so print this separated by spaces.
Sample 2
Input
9 5 7 4 123
Output
1 1 3 4
Sample 3
Input
31 41 59 26 535897932
Output
26 0 5 0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。