21157_Rinse

2022-5-16 18:18| 发布者: Hocassian| 查看: 45| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504946248100-Problem List-采集的数据-后羿采集器.html

Pro.ID

21157

Title

Rinse

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21157

AC

1

Submit

1

Ratio

100.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Granny's reunion was a smashing success. Next she is expecting a visit from Eliot Ness and in anticipation of his visit would like to remove as much whiskey from the cream can as possible prior to his visit.

    Granny can upend the cream can, thus pouring its contents on the ground. But due to surface tension and the shape of the can a small amount of the content remains, even after the can is upended. Granny has a barrel full of rain water that she can use to rinse the can several times. Each rinse involves pouring some amount of water (perhaps none) into the cream can, mixing it thoroughly with the existing contents, and pouring it out. After each rinse an amount of liquid remains, some fraction of which is whiskey and the rest water.

    Mr. Ness' visit is imminent, affording Granny the time to do at most k rinses. You are to determine a rinsing strategy that Granny should employ to minimize the amount of residual whiskey in the cream can after the last rinse.

    输入

    Standard input consists of several test cases. Each test case is represented by a line with five numbers:

    • 0 < k ≤ 100 -- an integer denoting the maximum number of rinses

    • Vb > 0 -- a real number denoting the volume of available rain water in the barrel

    • Vw > 0 -- a real number denoting the volume of whiskey in the cream can

    • Vr > 0 -- a real number denoting the volume of liquid that cannot be poured out by upending the can (further liquid might be eliminated by evaporation, but there is insufficient time before Ness' visit for any evaporation to take place)

    • Vc > Vw, Vr -- a real number denoting the maximum capacity of the cream can.

    A line containing 0 follows the last case.

    输出

    Description

    Granny's reunion was a smashing success. Next she is expecting a visit from Eliot Ness and in anticipation of his visit would like to remove as much whiskey from the cream can as possible prior to his visit.

    Granny can upend the cream can, thus pouring its contents on the ground. But due to surface tension and the shape of the can a small amount of the content remains, even after the can is upended. Granny has a barrel full of rain water that she can use to rinse the can several times. Each rinse involves pouring some amount of water (perhaps none) into the cream can, mixing it thoroughly with the existing contents, and pouring it out. After each rinse an amount of liquid remains, some fraction of which is whiskey and the rest water.

    Mr. Ness' visit is imminent, affording Granny the time to do at most k rinses. You are to determine a rinsing strategy that Granny should employ to minimize the amount of residual whiskey in the cream can after the last rinse.

    Input

    Standard input consists of several test cases. Each test case is represented by a line with five numbers:

    • 0 < k ≤ 100 -- an integer denoting the maximum number of rinses

    • Vb > 0 -- a real number denoting the volume of available rain water in the barrel

    • Vw > 0 -- a real number denoting the volume of whiskey in the cream can

    • Vr > 0 -- a real number denoting the volume of liquid that cannot be poured out by upending the can (further liquid might be eliminated by evaporation, but there is insufficient time before Ness' visit for any evaporation to take place)

    • Vc > Vw, Vr -- a real number denoting the maximum capacity of the cream can.

    A line containing 0 follows the last case.

    Output

    For each test case, output r, the number of rinses that Granny should perform. On the same line, output r real numbers, rounded to two decimal places, giving the amount of rain water to be used for each rinse, in order.

    Note that the total amount of water used in all rinses must not exceed Vb. The total amount of liquid in the cream can cannot exceed Vc at any time. Assume that whiskey and water mix perfectly and that their volumes are additive; that is, x units of whiskey and y units of water combine to form x+y units of liquid.

    Sample Input

    2 15.0 25.0 1.0 50.0
    0

    Sample Output

    2 0.00 15.00

    Source

    样例输入

    2 15.0 25.0 1.0 50.0
    0

    样例输出

    2 0.00 15.00

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部