#K37067. Counting Different Big Rods
Counting Different Big Rods
Counting Different Big Rods
Given rods with lengths in the interval \([L,R]\), a big rod is formed by choosing a contiguous segment from these rods. In other words, if there are \(n = R-L+1\) rods available, you can form a big rod by selecting any consecutive subsequence of these rods. The total number of different big rods you can form is given by the formula:
\[ \frac{n \times (n+1)}{2} \]Your task is to compute this number for each test case.
inputFormat
The first line of the input contains a single integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains two space-separated integers \(L\) and \(R\) denoting the lower and upper bounds, respectively.
outputFormat
For each test case, print a single line with the number of different big rods that can be formed.
## sample1
1 1
1
</p>