Gldr gives you two numbers \(L\) and \(R\) and he wants the sum of the difference between every adjacent element between \(L\) and \(R\).
Sum is calculated as follows : \(\sum_{i=L}^{R-1} (i+1) - (i)\)
For Example : if \(L\) = 1 and \(R\) = 3, the sum = (2-1) + (3-2) , so sum = 2 .
Constrains :
\(1 \leq T \leq 100\)
\(-10^9 \leq L < R \leq 10^9\) .
Input :
The first line contains one number \(T\) the number of test cases .
The second line contains two numbers \(L\) and \(R\) .
Output :
Print one number the sum of the difference between every adjacent elements between \(L\) and \(R\) .
For test case 1 , sum = 1 - 0 = 1
For test case 2 , sum= 0 - (-1) =1
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor