#P4609. [FJOI2016] 建筑师
[FJOI2016] 建筑师
Description
Xiao Z is a very famous architect. One day he received a strange task: build buildings on a number line, where each building’s height is an integer between and .
Xiao Z has severe OCD; he dislikes having two buildings with the same height. Moreover, Xiao Z feels that a skyline is uniquely beautiful if, when viewed from the far left (all buildings lie to the right), exactly buildings are visible, and when viewed from the far right (all buildings lie to the left), exactly buildings are visible. Now Xiao Z wants to know how many building arrangements satisfy all of the above conditions.
Building is visible from the left (right) if there is no building taller than it on its left (right). Two arrangements are different if and only if there exists at least one building whose height differs between the two arrangements.
Input Format
The first line contains an integer , the number of test cases.
Each of the next lines contains three integers .
Output Format
For each test case, output the answer .
2
3 2 2
3 1 2
2
1
Hint
For of the testdata: .
For of the testdata: .
For of the testdata: .
For of the testdata: $1 \leq n \leq 50000, \ 1 \leq A, B \leq 100, \ 1 \leq T \leq 200000$.
Translated by ChatGPT 5
京公网安备 11011102002149号