CF126A.Hot Bath

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bob is about to take a hot bath.

There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is _t_1, and the hot water's temperature is _t_2. The cold water tap can transmit any integer number of water units per second from 0 to _x_1, inclusive. Similarly, the hot water tap can transmit from 0 to _x_2 water units per second.

If _y_1 water units per second flow through the first tap and _y_2 water units per second flow through the second tap, then the resulting bath water temperature will be:

Bob wants to open both taps so that the bath water temperature was not less than _t_0. However, the temperature should be as close as possible to this value. If there are several optimal variants, Bob chooses the one that lets fill the bath in the quickest way possible.

Determine how much each tap should be opened so that Bob was pleased with the result in the end.

鲍勃正准备洗一个热水澡。

浴缸有两个水龙头:一个热水龙头和一个冷水龙头。冷水温度为 t1t_1,热水温度为 t2t_2。冷水龙头每秒可输送 00 到 x1x_1(含端点)之间的任意整数单位水量;同理,热水龙头每秒可输送 00 到 x2x_2(含端点)之间的任意整数单位水量。

若第一(冷水)龙头每秒流过 y1y_1 单位水量,第二(热水)龙头每秒流过 y2y_2 单位水量,则混合后浴缸水温为:

鲍勃希望同时打开两个水龙头,使得浴缸水温不低于 t0t_0,且尽可能接近该值。若存在多种满足条件的方案,则鲍勃选择其中注满浴缸所需时间最短的方案(即总流量 y1+y2y_1 + y_2 最大)。

请确定两个水龙头各自应设定的流量(即 y1y_1 和 y2y_2 的取值),使得最终结果令鲍勃满意。

输入格式

You are given five integers _t_1, _t_2, _x_1, _x_2 and _t_0 (1 ≤ _t_1 ≤ _t_0 ≤ _t_2 ≤ 106, 1 ≤ _x_1, _x_2 ≤ 106).

给你五个整数 t1t_1、t2t_2、x1x_1、x2x_2 和 t0t_0(满足 1 ≤ t1 ≤ t0 ≤ t2 ≤ 1061 ≤ t_1 ≤ t_0 ≤ t_2 ≤ 10^6,1 ≤ x1, x2 ≤ 1061 ≤ x_1, x_2 ≤ 10^6)。

输出格式

Print two space-separated integers _y_1 and _y_2 (0 ≤ _y_1 ≤ _x_1, 0 ≤ _y_2 ≤ _x_2).

输出两个用空格分隔的整数 y1y_1 和 y2y_2(满足 0 ≤ y1 ≤ x10 \le y_1 \le x_1,0 ≤ y2 ≤ x20 \le y_2 \le x_2)。

输入输出样例

  • 输入#1

    10 70 100 100 25

    输出#1

    99 33
  • 输入#2

    300 500 1000 1000 300

    输出#2

    1000 0
  • 输入#3

    143 456 110 117 273

    输出#3

    76 54

说明/提示

In the second sample the hot water tap shouldn't be opened, but the cold water tap should be opened at full capacity in order to fill the bath in the quickest way possible.

在第二个样例中,不应打开热水龙头,而应将冷水龙头开到最大流量,以最快地注满浴缸。

输入解题思路,AI测评打分。不知道怎么写?

首页