欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1054A.Elevator or Stairs?
Elevator or Stairs?
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 , Egor on the floor (not on the same floor with Masha).
The house has a staircase and an elevator. If Masha uses the stairs, it takes seconds for her to walk between adjacent floors (in each direction). The elevator passes between adjacent floors (in each way) in seconds. The elevator moves with doors closed. The elevator spends 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 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.
Input
The only line contains six integers , , , , , () — 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 .
Output
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).
Note
In the first example:
If Masha goes by the stairs, the time she spends is , because she has to go times between adjacent floors and each time she spends seconds.
If she chooses the elevator, she will have to wait seconds while the elevator leaves the -th floor and goes to the -th. After that the doors will be opening for another second. Then Masha will enter the elevator, and she will have to wait for second for the doors closing. Next, the elevator will spend seconds going from the -th floor to the -st, because the elevator has to pass times between adjacent floors and spends seconds each time. And finally, it will take another second before the doors are open and Masha can come out.
Thus, all the way by elevator will take seconds, which is less than 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 seconds to use the elevator, that is more than the 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 seconds. That means Masha will take the elevator.
Samples
5 1 4 4 2 1
YES
1 6 6 2 1 1
NO
4 1 7 4 1 2
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |