cswork / OA打开练习工作台

AmazonOA #8

Data Dependence Sum

估计中等可在线判题

考点(AI 标注)位运算

Given a positive integer n, consider floor(n/k) for every positive integer k. Sum the distinct quotient values that occur. k may exceed n, in which case the quotient is 0, which does not affect the sum. Each quotient value is counted only once.

输入格式

Input n (1..10¹⁰); use a 64-bit integer to store the result.

输出格式

Output a single integer, the answer required by the problem.

样例 1

输入:

5

输出:

8

样例 2

输入:

1

输出:

1

样例 3

输入:

10

输出:

21

样例说明

When n=5, the distinct quotients are 5, 2, 1, 0, and their sum is 8.