300660: CF126A. Hot Bath

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hot Bath

题意翻译

浴缸里有一个冷水龙头和一个热水龙头,流出的水温分别是t1和t2;它们的流速最大是x1和x2个单位每秒,并且可以调节到0至最大流速间的任意一个整数速度。假如两个龙头的流速分别是y1和y2,那么最终的水温就是 t = ((t1y1)+(t2y2))/(y1+y2) 现在,你要安排两个水龙头的流速,满足: 1、最终水温不低于t0; 2、在满足上一条的前提下,水温尽可能接近t0; 3、在满足上一条的前提下,总流速尽可能大。 1 <= t1 <= t0 <= t2 <= 10^6; 1 <= x1, x2 <= 10^6

题目描述

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: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF126A/7077871c8558e9c2406531a263828623638aedde.png)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.

输入输出格式

输入格式


You are given five integers $ t_{1} $ , $ t_{2} $ , $ x_{1} $ , $ x_{2} $ and $ t_{0} $ ( $ 1<=t_{1}<=t_{0}<=t_{2}<=10^{6} $ , $ 1<=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} $ ).

输入输出样例

输入样例 #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.

Input

题意翻译

浴缸里有一个冷水龙头和一个热水龙头,流出的水温分别是t1和t2;它们的流速最大是x1和x2个单位每秒,并且可以调节到0至最大流速间的任意一个整数速度。假如两个龙头的流速分别是y1和y2,那么最终的水温就是 t = ((t1y1)+(t2y2))/(y1+y2) 现在,你要安排两个水龙头的流速,满足: 1、最终水温不低于t0; 2、在满足上一条的前提下,水温尽可能接近t0; 3、在满足上一条的前提下,总流速尽可能大。 1 <= t1 <= t0 <= t2 <= 10^6; 1 <= x1, x2 <= 10^6

加入题单

算法标签: