A12294 | Radix sum
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Let's define radix sum of number $a$ consisting of digits $a_1, \ldots ,a_k$ and number $b$ consisting of digits $b_1, \ldots ,b_k$ (we add leading zeroes to the shorter number to match longer length) as number $s(a,b)$ consisting of digits $(a_1+b_1)\mod 10, \ldots ,(a_k+b_k)\mod 10$ . The radix sum of several integers is defined as follows: $s(t_1, \ldots ,t_n)=s(t_1,s(t_2, \ldots ,t_n))$
You are given an array $x_1, \ldots ,x_n$ . The task is to compute for each integer $i (0 \le i < n)$ number of ways to consequently choose one of the integers from the array $n$ times, so that the radix sum of these integers is equal to $i$ . Calculate these values modulo $2^{58}$ .
You are given an array $x_1, \ldots ,x_n$ . The task is to compute for each integer $i (0 \le i < n)$ number of ways to consequently choose one of the integers from the array $n$ times, so that the radix sum of these integers is equal to $i$ . Calculate these values modulo $2^{58}$ .
输入格式
The first line contains integer $n$ — the length of the array( $1 \leq n \leq 100000$ ).
The second line contains $n$ integers $x_1, \ldots x_n$ — array elements( $0 \leq x_i < 100000$ ).
The second line contains $n$ integers $x_1, \ldots x_n$ — array elements( $0 \leq x_i < 100000$ ).
输出格式
Output $n$ integers $y_0, \ldots, y_{n-1}$ — $y_i$ should be equal to corresponding number of ways modulo $2^{58}$ .
输入输出样例
输入 #1
2 5 6
输出 #1
1 2
输入 #2
4 5 7 5 7
输出 #2
16 0 64 0
In the first example there exist sequences: sequence $(5,5)$ with radix sum $0$ , sequence $(5,6)$ with radix sum $1$ , sequence $(6,5)$ with radix sum $1$ , sequence $(6,6)$ with radix sum $2$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted