CF1729A.Two Elevators

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Vlad went into his appartment house entrance, now he is on the 11 -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 aa (it is currently motionless),
  • the second elevator is located on floor bb and goes to floor cc ( bcb \ne c ). Please note, if b=1b=1 , then the elevator is already leaving the floor 11 and Vlad does not have time to enter it.

If you call the first elevator, it will immediately start to go to the floor 11 . If you call the second one, then first it will reach the floor cc and only then it will go to the floor 11 . It takes xy|x - y| seconds for each elevator to move from floor xx to floor yy .

Vlad wants to call an elevator that will come to him faster. Help him choose such an elevator.

输入格式

The first line of the input contains the only tt ( 1t1041 \le t \le 10^4 ) — the number of test cases.

This is followed by tt lines, three integers each aa , bb and cc ( 1a,b,c1081 \le a, b, c \le 10^8 , bcb \ne c ) — floor numbers described in the statement.

输出格式

Output tt numbers, each of which is the answer to the corresponding test case. As an answer, output:

  • 11 , if it is better to call the first elevator;
  • 22 , if it is better to call the second one;
  • 33 , if it doesn't matter which elevator to call (both elevators will arrive in the same time).

输入输出样例

  • 输入#1

    3
    1 2 3
    3 1 2
    3 2 1

    输出#1

    1
    3
    2

说明/提示

In the first test case of the example, the first elevator is already on the floor of 11 .

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 33 , and the second one is on the floor of 11 , but is already going to another floor;
  • in 11 second after the call, the first elevator would be on the floor 22 , the second one would also reach the floor 22 and now can go to the floor 11 ;
  • in 22 seconds, any elevator would reach the floor 11 .

In the third test case of the example, the first elevator will arrive in 22 seconds, and the second in 11 .

首页