P1836 Sum of Page Digits
Description
A book’s page numbers are the consecutive integers from $1\sim n$: $1,2,3,\cdots,n$. Please compute the sum of all individual digits across all page numbers; for example, for page $123$, its sum is $ 1+2+3=6$.
Input Format
A single integer $n$ on one line.
Output Format
One line containing the sum of all individual digits.
Explanation/Hint
Constraints: $1\le n\le 10^9$.
Translated by ChatGPT 5