P18519 [CodeChef] SPCTRIPS
提高-
题目描述

Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Gintoki has been very lazy recently and he hasn't made enough money to pay the rent this month. So the old landlady has given him a problem to solve instead, if he can solve this problem the rent will be waived.
The problem is as follows:

A triplet of integers (A, B, C) is considered to be special if it satisfies the following properties for a given integer N :

$A \bmod B = C$
$B \bmod C = 0$
1 ≤ A, B, C ≤ N

Example: There are three special triplets for N = 3.
(1, 3, 1) is $a special triplet, since (1 \bmod 3) = 1$ and $(3 \bmod 1) = 0$.
(1, 2, 1) is $a special triplet, since (1 \bmod 2) = 1$ and $(2 \bmod 1) = 0$.
(3, 2, 1) is $a special triplet, since (3 \bmod 2) = 1$ and $(2 \bmod 1) = 0$.

The landlady gives Gintoki an integer N. Now Gintoki needs to find the number of special triplets. Can you help him to find the answer?

------ Input Format ------

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains a single integer N.

------ Output Format ------

  • For each testcase, output in a single line the number of special triplets.

------ Constraints ------

$1 ≤ T ≤ 10$
$2 ≤ N ≤ 10^{5}$

------ subtasks ------

Subtask #1 (5 points): $2 ≤N ≤10^{3}$

Subtask #2 (20 points): $2 ≤N ≤10^{4}$

Subtask #3 (75 points): Original constraints

----- Sample Input 1 ------
3
3
4
5
----- Sample Output 1 ------
3
6
9
----- explanation 1 ------
Test case $1$: It is explained in the problem statement.

Test case $2$: The special triplets are $(1, 3, 1)$, $(1, 2, 1)$, $(3, 2, 1)$, $(1, 4, 1)$, $(4, 3, 1)$, $(2, 4, 2)$. Hence the answer is $6$.

Test case $3$: The special triplets are $(1, 3, 1)$, $(1, 2, 1)$, $(3, 2, 1)$, $(1, 4, 1)$, $(4, 3, 1)$, $(1, 5, 1)$, $(5, 4, 1)$, $(5, 2, 1)$, $(2, 4, 2)$. Hence the answer is $9$.

输入格式

见题面

输出格式

见题面

样例输入
3 3 4 5
样例输出
3 6 9