C - Four Variables Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 300

問題文

正整数 N が与えられます。
正整数の組 (A,B,C,D) であって、AB + CD = N を満たすものの個数を求めてください。

なお、本問の制約の下、答えが 9 \times 10^{18} 以下であることが証明できます。

制約

  • 2 \leq N \leq 2 \times 10^5
  • N は整数

入力

入力は以下の形式で標準入力から与えられる。

N

出力

答えを出力せよ。


入力例 1

4

出力例 1

8

(A,B,C,D) として以下の 8 個が考えられます。

  • (A,B,C,D)=(1,1,1,3)
  • (A,B,C,D)=(1,1,3,1)
  • (A,B,C,D)=(1,2,1,2)
  • (A,B,C,D)=(1,2,2,1)
  • (A,B,C,D)=(1,3,1,1)
  • (A,B,C,D)=(2,1,1,2)
  • (A,B,C,D)=(2,1,2,1)
  • (A,B,C,D)=(3,1,1,1)

入力例 2

292

出力例 2

10886

入力例 3

19876

出力例 3

2219958

Score : 300 points

Problem Statement

You are given a positive integer N.
Find the number of quadruples of positive integers (A,B,C,D) such that AB + CD = N.

Under the constraints of this problem, it can be proved that the answer is at most 9 \times 10^{18}.

Constraints

  • 2 \leq N \leq 2 \times 10^5
  • N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print the answer.


Sample Input 1

4

Sample Output 1

8

Here are the eight desired quadruples.

  • (A,B,C,D)=(1,1,1,3)
  • (A,B,C,D)=(1,1,3,1)
  • (A,B,C,D)=(1,2,1,2)
  • (A,B,C,D)=(1,2,2,1)
  • (A,B,C,D)=(1,3,1,1)
  • (A,B,C,D)=(2,1,1,2)
  • (A,B,C,D)=(2,1,2,1)
  • (A,B,C,D)=(3,1,1,1)

Sample Input 2

292

Sample Output 2

10886

Sample Input 3

19876

Sample Output 3

2219958