102304: [AtCoder]ABC230 E - Fraction Floor Sum

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $500$ points

Problem Statement

Given is a positive integer $N$. Find the value $\displaystyle\sum_{i=1}^N \left[ \frac{N}{i} \right]$.

Here, for a real number $x$, $[x]$ denotes the largest integer not exceeding $x$.

Constraints

  • $1 \leq N \leq 10^{12}$
  • $N$ is an integer.

Input

Input is given from Standard Input in the following format:

$N$

Output

Print the answer.


Sample Input 1

3

Sample Output 1

5

We have $\left[ \frac{3}{1} \right]+\left[ \frac{3}{2} \right]+\left[ \frac{3}{3} \right]=3+1+1=5$.


Sample Input 2

10000000000

Sample Output 2

231802823220

Note that the input and output may not fit into a $32$-bit integer type.

Input

题意翻译

## 题目描述 求 $\large{\sum\limits_{i=1}^N ⌊\frac{N}{i}⌋}$ 的值 ## 输入格式 一行一个整数 $N$ ## 输出格式 一行一个整数,你的答案

Output

得分:500分 部分 问题描述 给定一个正整数N。求$\displaystyle\sum_{i=1}^N \left[ \frac{N}{i} \right]$的值。 在这里,对于实数$x$,$[x]$表示不大于$x$的最大整数。 部分 约束条件 * $1 \leq N \leq 10^{12}$ * $N$是一个整数。 --- 部分 输入格式 从标准输入按照以下格式获取输入: $N$ --- 部分 输出格式 输出答案。 --- 部分 样例输入1 3 --- 部分 样例输出1 5 我们有$\left[ \frac{3}{1} \right]+\left[ \frac{3}{2} \right]+\left[ \frac{3}{3} \right]=3+1+1=5$。 --- 部分 样例输入2 10000000000 --- 部分 样例输出2 231802823220 注意:输入和输出可能不适用于32位整数类型。

加入题单

算法标签: