409647: GYM103652 L Pyramid

Memory Limit:0 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. Pyramidtime limit per test2 secondsmemory limit per test256 mebibytesinputstandard inputoutputstandard output

A side surface of a pyramid can be cut into many equilateral triangles, whose vertices can be grouped into different levels from top to bottom, such that the first level contains one vertex, the second level contains two, and so on.

As the image shows, for example, two adjacent level-$$$k$$$ vertices with a level-$$$(k - 1)$$$ vertex can form an upright equilateral triangle, and two adjacent level-$$$k$$$ vertices with a level-$$$(k + 1)$$$ vertex can form an inverted equilateral triangle as well. Also, three vertices at three different levels can form an equilateral triangle, which may be oblique.

If we only consider vertices between level $$$l$$$ and level $$$r$$$ (inclusive), in how many ways can we choose three equidistant vertices so that they can form an equilateral triangle?

Input

The input contains several test cases. The first line contains an integer $$$T$$$ indicating the number of test cases. The following describes all test cases. For each test case:

The only line contains two integers $$$l$$$ and $$$r$$$.

  • $$$1 \leq T \leq 3 \times 10^5$$$
  • $$$1 \leq l \leq r \leq 10^5$$$
Output

For each test case, output a line containing "Case #x: y" (without quotes), where x is the test case number starting from $$$1$$$, and y is the answer to this test case.

ExampleInput
3
1 3
2 4
3 5
Output
Case #1: 5
Case #2: 12
Case #3: 20

加入题单

算法标签: