103533: [Atcoder]ABC353 D - Another Sigma Problem
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:16
Solved:0
Description
Score: $400$ points
Problem Statement
For positive integers $x$ and $y$, define $f(x, y)$ as follows:
- Interpret the decimal representations of $x$ and $y$ as strings and concatenate them in this order to obtain a string $z$. The value of $f(x, y)$ is the value of $z$ when interpreted as a decimal integer.
For example, $f(3, 14) = 314$ and $f(100, 1) = 1001$.
You are given a sequence of positive integers $A = (A_1, \ldots, A_N)$ of length $N$. Find the value of the following expression modulo $998244353$:
$\displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^N f(A_i,A_j)$.Constraints
- $2 \leq N \leq 2 \times 10^5$
- $1 \leq A_i \leq 10^9$
- All input values are integers.
Input
The input is given from Standard Input in the following format:
$N$ $A_1$ $\ldots$ $A_N$
Output
Print the answer.
Sample Input 1
3 3 14 15
Sample Output 1
2044
- $f(A_1, A_2) = 314$
- $f(A_1, A_3) = 315$
- $f(A_2, A_3) = 1415$
Thus, the answer is $f(A_1, A_2) + f(A_1, A_3) + f(A_2, A_3) = 2044$.
Sample Input 2
5 1001 5 1000000 1000000000 100000
Sample Output 2
625549048
Be sure to calculate the value modulo $998244353$.
Output
得分:400分
---
问题描述
对于正整数$x$和$y$,定义$f(x, y)$如下:
- 将$x$和$y$的十进制表示作为字符串按顺序连接,得到字符串$z$。$f(x, y)$的值是将$z$解释为十进制整数的值。
例如,$f(3, 14) = 314$和$f(100, 1) = 1001$。
给你一个长度为$N$的正整数序列$A = (A_1, \ldots, A_N)$。找出以下表达式对$998244353$取模的结果:
$\displaystyle \sum_{i=1}^{N-1}\sum_{j=i+1}^N f(A_i,A_j)$。限制条件
- $2 \leq N \leq 2 \times 10^5$
- $1 \leq A_i \leq 10^9$
- 所有输入值都是整数。
输入
标准输入以以下格式提供输入:
$N$ $A_1$ $\ldots$ $A_N$
输出
打印答案。
样例输入1
3 3 14 15
样例输出1
2044
- $f(A_1, A_2) = 314$
- $f(A_1, A_3) = 315$
- $f(A_2, A_3) = 1415$
因此,答案是$f(A_1, A_2) + f(A_1, A_3) + f(A_2, A_3) = 2044$。
样例输入2
5 1001 5 1000000 1000000000 100000
样例输出2
625549048
请确保对$998244353$取模计算结果。