AtCoder Regular Contest 153
翻译中…
Problem Statement
翻译中…
For a positive integer $x$, let $f(x)$ denote the sum of its digits. For instance, we have $f(153) = 1 + 5 + 3 = 9$, $f(2023) = 2 + 0 + 2 + 3 = 7$, and $f(1) = 1$.
翻译中…
You are given a sequence of positive integers $A = (A_1, \ldots, A_N)$. Find the minimum possible value of $\sum_{i=1}^N f(A_i + x)$ where $x$ is a non-negative integer.
翻译中…
Constraints
翻译中…
$1\leq N\leq 2\times 10^5$$1\leq A_i < 10^9$
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N
A_1 \ldots A_N
翻译中…
Output
翻译中…
Print the minimum possible value of $\sum_{i=1}^N f(A_i + x)$ where $x$ is a non-negative integer.
翻译中…
样例
Input #1
4
4 13 8 6
Output #1
14
For instance, $x = 7$ makes $\sum_{i=1}^N f(A_i+x) = f(11) + f(20) + f(15) + f(13) = 14$.
Input #2
4
123 45 678 90
Output #2
34
For instance, $x = 22$ makes $\sum_{i=1}^N f(A_i+x) = f(145) + f(67) + f(700) + f(112) = 34$.
Input #3
3
1 10 100
Output #3
3
For instance, $x = 0$ makes $\sum_{i=1}^N f(A_i+x) = f(1) + f(10) + f(100) = 3$.
Input #4
1
153153153
Output #4
1
For instance, $x = 9999846846847$ makes $\sum_{i=1}^N f(A_i+x) = f(10000000000000) = 1$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。