AtCoder Regular Contest 112
A
B = C
AtCoder
⌀ 0
原题
←B →
翻译中…

Problem Statement

翻译中…

How many triples $A,B,C$ of integers between $L$ and $R$ (inclusive) satisfy $A-B=C$?

翻译中…

You will be given $T$ cases. Solve each of them.

翻译中…

Constraints

翻译中…
  • $1 \leq T \leq 2\times 10^4$
  • $0\le L \le R \le 10^6$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\vdots
\text{case}_T

翻译中…

Each case is in the following format:

翻译中…

L R

翻译中…

Output

翻译中…

Print $T$ values; the $i$-th of them should be the answer for $\text{case}_i$.

翻译中…

样例

Input #1
5
2 6
0 0
1000000 1000000
12345 67890
0 1000000
Output #1
6
1
0
933184801
500001500001
In the first case, we have the following six triples: - $4 - 2 = 2$ - $5 - 2 = 3$ - $5 - 3 = 2$ - $6 - 2 = 4$ - $6 - 3 = 3$ - $6 - 4 = 2$
题目信息
题号
arc112_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。