名校训练1385: Just Pour the Water题解

初见你 算法基础篇 62 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
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).

名校训练1385: Just Pour the Water题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
想要在职场中立于不败之地?那就来试试全网最全C++题库,让您在练习中快速提升技能。

标签: 名校训练1385: Just Pour the Water题解