time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
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:
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 |x−y||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.
Input
The first line of the input contains the only tt (1≤t≤1041≤t≤104) — the number of test cases.
This is followed by tt lines, three integers each aa, bb and cc (1≤a,b,c≤1081≤a,b,c≤108, b≠cb≠c) — floor numbers described in the statement.
Output
Output tt numbers, each of which is the answer to the corresponding test case. As an answer, output:
Example
input
Copy
3
1 2 3
3 1 2
3 2 1
output
Copy
1 3 2
Note
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:
In the third test case of the example, the first elevator will arrive in 22 seconds, and the second in 11.
解题说明:水题,直接计算两个电梯的耗时,然后比较即可,第二部电梯需要分别计算b大于c和b小于c的情况。
- #include
- #include
-
- int main()
- {
- int t;
- scanf("%d", &t);
- while (t--)
- {
- int a, b, c, m;
- scanf("%d%d%d", &a, &b, &c);
- if (b >= c)
- {
- m = b;
- }
- else
- {
- m = (c + c - b);
- }
- if (a == m)
- {
- printf("3\n");
- }
- else if (a < m)
- {
- printf("1\n");
- }
- else
- {
- printf("2\n");
- }
- }
- return 0;
- }