Bronze-2018Dec-Mixing Milk

这道题目描述了农夫John如何将三头奶牛的牛奶混合,通过在三个不同大小的桶之间倒牛奶进行混合,共进行100次操作。在每次倒牛奶的过程中,会尽可能倒满或倒空一个桶。程序需要计算经过100次操作后,每个桶中剩余的牛奶量。
摘要由CSDN通过智能技术生成

Fortunately, Farmer John has a good idea. His three prize dairy cows Bessie, Elsie, and Mildred each produce milk with a slightly different taste, and he plans to mix these together to get the perfect blend of flavors.

To mix the three different milks, he takes three buckets containing milk from the three cows. The buckets may have different sizes, and may not be completely full. He then pours bucket 1 into bucket 2, then bucket 2 into bucket 3, then bucket 3 into bucket 1, then bucket 1 into bucket 2, and so on in a cyclic fashion, for a total of 100 pour operations (so the 100th pour would be from bucket 1 into bucket 2). When Farmer John pours from bucket aa into bucket bb, he pours as much milk as possible until either bucket aa becomes empty or bucket bb becomes full.

Please tell Farmer John how much milk will be in each bucket after he finishes all 100 pours.

INPUT FORMAT (file mixmilk.in):

The first line of the input file contains two

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xy404chef

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值