CF1054A.Elevator or Stairs?

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor xx , Egor on the floor yy (not on the same floor with Masha).

The house has a staircase and an elevator. If Masha uses the stairs, it takes t1t_1 seconds for her to walk between adjacent floors (in each direction). The elevator passes between adjacent floors (in each way) in t2t_2 seconds. The elevator moves with doors closed. The elevator spends t3t_3 seconds to open or close the doors. We can assume that time is not spent on any action except moving between adjacent floors and waiting for the doors to open or close. If Masha uses the elevator, it immediately goes directly to the desired floor.

Coming out of the apartment on her floor, Masha noticed that the elevator is now on the floor zz and has closed doors. Now she has to choose whether to use the stairs or use the elevator.

If the time that Masha needs to get to the Egor's floor by the stairs is strictly less than the time it will take her using the elevator, then she will use the stairs, otherwise she will choose the elevator.

Help Mary to understand whether to use the elevator or the stairs.

输入格式

The only line contains six integers xx , yy , zz , t1t_1 , t2t_2 , t3t_3 ( 1x,y,z,t1,t2,t310001 \leq x, y, z, t_1, t_2, t_3 \leq 1000 ) — the floor Masha is at, the floor Masha wants to get to, the floor the elevator is located on, the time it takes Masha to pass between two floors by stairs, the time it takes the elevator to pass between two floors and the time it takes for the elevator to close or open the doors.

It is guaranteed that xyx \ne y .

输出格式

If the time it will take to use the elevator is not greater than the time it will take to use the stairs, print «YES» (without quotes), otherwise print «NO> (without quotes).

You can print each letter in any case (upper or lower).

输入输出样例

  • 输入#1

    5 1 4 4 2 1
    

    输出#1

    YES
  • 输入#2

    1 6 6 2 1 1
    

    输出#2

    NO
  • 输入#3

    4 1 7 4 1 2
    

    输出#3

    YES

说明/提示

In the first example:

If Masha goes by the stairs, the time she spends is 44=164 \cdot 4 = 16 , because she has to go 44 times between adjacent floors and each time she spends 44 seconds.

If she chooses the elevator, she will have to wait 22 seconds while the elevator leaves the 44 -th floor and goes to the 55 -th. After that the doors will be opening for another 11 second. Then Masha will enter the elevator, and she will have to wait for 11 second for the doors closing. Next, the elevator will spend 42=84 \cdot 2 = 8 seconds going from the 55 -th floor to the 11 -st, because the elevator has to pass 44 times between adjacent floors and spends 22 seconds each time. And finally, it will take another 11 second before the doors are open and Masha can come out.

Thus, all the way by elevator will take 2+1+1+8+1=132 + 1 + 1 + 8 + 1 = 13 seconds, which is less than 1616 seconds, so Masha has to choose the elevator.

In the second example, it is more profitable for Masha to use the stairs, because it will take 1313 seconds to use the elevator, that is more than the 1010 seconds it will takes to go by foot.

In the third example, the time it takes to use the elevator is equal to the time it takes to walk up by the stairs, and is equal to 1212 seconds. That means Masha will take the elevator.

首页