欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1729A.Two Elevators
Two Elevators
Vlad went into his appartment house entrance, now he is on the -th floor. He was going to call the elevator to go up to his apartment.
There are only two elevators in his house. Vlad knows for sure that:
- the first elevator is currently on the floor (it is currently motionless),
- the second elevator is located on floor and goes to floor (). Please note, if , then the elevator is already leaving the floor and Vlad does not have time to enter it.
If you call the first elevator, it will immediately start to go to the floor . If you call the second one, then first it will reach the floor and only then it will go to the floor . It takes seconds for each elevator to move from floor to floor .
Vlad wants to call an elevator that will come to him faster. Help him choose such an elevator.
Input
The first line of the input contains the only () — the number of test cases.
This is followed by lines, three integers each , and (, ) — floor numbers described in the statement.
Output
Output numbers, each of which is the answer to the corresponding test case. As an answer, output:
- , if it is better to call the first elevator;
- , if it is better to call the second one;
- , if it doesn't matter which elevator to call (both elevators will arrive in the same time).
Note
In the first test case of the example, the first elevator is already on the floor of .
In the second test case of the example, when called, the elevators would move as follows:
- At the time of the call, the first elevator is on the floor of , and the second one is on the floor of , but is already going to another floor;
- in second after the call, the first elevator would be on the floor , the second one would also reach the floor and now can go to the floor ;
- in seconds, any elevator would reach the floor .
In the third test case of the example, the first elevator will arrive in seconds, and the second in .
Samples
3
1 2 3
3 1 2
3 2 1
1
3
2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |