#P4450. 双亲数

    ID: 3382 远端评测题 2000ms 63MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>数学莫比乌斯反演块状链表,块状数组,分块

双亲数

Description

Xiao D is a math enthusiast, and his obsession with numbers has reached a crazy level.

We use d=gcd(a,b)d = \gcd(a, b) to denote the greatest common divisor of aa and bb. Xiao D insists that such a close relationship can be described as parents. In this case, we call the ordered pair (a,b)(a, b) a parent pair of dd.

Unlike normal parents, for the same dd, it has too many parents.

For example, (4,6)(4, 6), (6,4)(6, 4), (2,100)(2, 100) are all parent pairs of 22.
Thus the following question arises: for 1aA1 \leq a \leq A, 1bB1 \leq b \leq B, how many ordered pairs (a,b)(a, b) are parent pairs of dd?

Input Format

The input contains a single line with three integers, representing AA, BB, and dd.

Output Format

Output a single integer on one line representing the answer.

5 5 2

3

Hint

Sample 1 Explanation

There are three parent pairs: (2,2)(2, 2), (2,4)(2, 4), (4,2)(4, 2).

Constraints

  • For 100%100\% of the testdata, it is guaranteed that 1A,B1061 \leq A, B \leq 10^6, 1dmin(A,B)1 \leq d \leq \min(A, B).

Translated by ChatGPT 5