P27684 [洛谷] Dedication
提高
题目描述

Problem Background

The relentless spirit of self-improvement in mathematics — Dedication.

Lisa, known as the "Light of Dedication," is both a priestess of the "God of Order" Palla and a follower of the "God of Chaos" Dionysus.

Recently, Lisa has learned high-precision division and can now compute division of $n$-digit integers with a time complexity of $\Theta(n \log n)$.

Problem Description

Lisa wants to create a division table for positive integers up to $n$. Specifically, it is a table that records $\lfloor a/b \rfloor$ where $1 \leq b \leq a \leq n$ and both $a$ and $b$ are integers. She creates it using the following method:

Enumerate positions $(a, b)$ in ascending order with $a$ as the primary key and $b$ as the secondary key. If the position $(a, b)$ is not filled, then:

Calculate $\lfloor a/b \rfloor$, which requires mana equal to $d_a \log_2 d_a$ (where $d_a$ represents the number of digits of $a$ in base 10, i.e., $d_a = \lfloor 1 + \log_{10} a \rfloor$). Then, enumerate positive integers $i$ and fill all unfilled positions $(ai, bi)$ (where $\leq n$) with $\lfloor a/b \rfloor$. Each fill operation consumes mana equal to $d_i$.

Since Mina has already created a multiplication table, Lisa can compute multiplications without using mana. Now, Lisa wants to know how much mana is required to create the entire division table.

To prevent precision issues, your output is considered correct if the relative error with the standard output does not exceed $10^{-6}$. The relative error between the standard output and the actual answer is guaranteed to be within $10^{-10}$.

Input Format

Input consists of a single line containing a positive integer $n$, representing the size of the division table to be created.

Output Format

Output a single real number, representing the answer.

Sample Input and Output

Sample Input #1

6

Sample Output #1

21.0000000

Sample Input #2

20

Sample Output #2

422.0000000

Sample Input #3

233

Sample Output #3

99838.0384544

Notes

Sample 1 Explanation

Since $a \leq 6$, $d_a = 1$, thus $d_a \log_2 d_a = 0$. This means only filling numbers consumes mana. Each $i$ also does not exceed $6$, satisfying $d_i = 1$, so each fill operation consumes a fixed 1 mana. Filling all $1 + 2 + 3 + 4 + 5 + 6 = 21$ numbers consumes 21 mana.

Hence, the answer is 21.

Data Range

This problem uses subtask-based scoring.

Subtask 1 (15 pts): $n \leq 5000$;
Subtask 2 (15 pts): $n \leq 10^5$;
Subtask 3 (30 pts): $n \leq 2 \times 10^6$;
Subtask 4 (40 pts): No additional constraints.

For all data, $1 \leq n \leq 2 \times 10^7$.

Hint

$\log_2 n$ is read as "the logarithm of $n$ to base 2". If $x = \log_2 n$, it means $2^x = n$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6
样例输出
21.0000000