Shirly is a very clever girl. Now she has two containers , each with some water. Every minute,she pours half of the water in A into B, and simultaneous pours half of the water in B into A. As the. pouring continues, she finds it is very easy to calculate the amount of water in A and B at any time. It is. But now Shirly wants to know how to calculate the amount of water in each container if there are more. than two containers. Then the problem becomes challenging.
Shirly is a very clever girl. Now she has two containers (A and B), each with some water. Every minute, she pours half of the water in A into B, and simultaneous pours half of the water in B into A. As the pouring continues, she finds it is very easy to calculate the amount of water in A and B at any time. It is really an easy job :). But now Shirly wants to know how to calculate the amount of water in each container if there are more than two containers. Then the problem becomes challenging. Now Shirly has N (2 <= N <= 20) containers (numbered from 1 to N ). Every minute, each container is supposed to pour water into another K containers ( K may vary for different containers). Then the water will be evenly divided into K portions and accordingly poured into anther K containers. Now the question is: how much water exists in each container at some specified time? For example, container 1 is specified to pour its water into container 1, 2, 3. Then in every minute, container 1 will pour its 1/3 of its water into container 1, 2, 3 separately (actually, 1/3 is poured back to itself, this is allowed by the rule of the game).