#abc292c. C - Four Variables

C - Four Variables

Score : 300300 points

问题描述

给定一个正整数 NN

找出满足条件 AB+CD=NAB + CD = N 的正整数四元组 (A,B,C,D)(A, B, C, D) 的数量。

在本问题的约束条件下,可以证明答案最多为 9×10189 \times 10^{18}

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

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

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

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • NN is an integer.

Input

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

NN

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,1,3)
  • (A,B,C,D)=(1,1,3,1)(A,B,C,D)=(1,1,3,1)
  • (A,B,C,D)=(1,2,1,2)(A,B,C,D)=(1,2,1,2)
  • (A,B,C,D)=(1,2,2,1)(A,B,C,D)=(1,2,2,1)
  • (A,B,C,D)=(1,3,1,1)(A,B,C,D)=(1,3,1,1)
  • (A,B,C,D)=(2,1,1,2)(A,B,C,D)=(2,1,1,2)
  • (A,B,C,D)=(2,1,2,1)(A,B,C,D)=(2,1,2,1)
  • (A,B,C,D)=(3,1,1,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

update @ 2024/3/10 12:10:44