CF1103E.Radix sum

NOI/NOI+/CTSC

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's define radix sum of number aa consisting of digits a1,…,aka_1, \ldots ,a_k and number bb consisting of digits b1,…,bkb_1, \ldots ,b_k(we add leading zeroes to the shorter number to match longer length) as number s(a,b)s(a,b) consisting of digits (a1+b1)mod  10,…,(ak+bk)mod  10(a_1+b_1)\mod 10, \ldots ,(a_k+b_k)\mod 10. The radix sum of several integers is defined as follows: s(t1,…,tn)=s(t1,s(t2,…,tn))s(t_1, \ldots ,t_n)=s(t_1,s(t_2, \ldots ,t_n))

You are given an array x1,…,xnx_1, \ldots ,x_n. The task is to compute for each integer i(0≤i<n)i (0 \le i \lt n) number of ways to consequently choose one of the integers from the array nn times, so that the radix sum of these integers is equal to ii. Calculate these values modulo 2582^{58}.

我们定义数字 aa(其各位数字为 a1,…,aka_1, \ldots ,a_k)与数字 bb(其各位数字为 b1,…,bkb_1, \ldots ,b_k)的进位制和(radix sum)为一个数字 s(a,b)s(a,b),其各位数字为 (a1+b1) mod 10,…,(ak+bk) mod 10(a_1+b_1)\bmod 10, \ldots ,(a_k+b_k)\bmod 10(若两数位数不同,则在较短数字前补前导零,使其长度与较长者一致)。
多个整数的进位制和定义如下:s(t1,…,tn)=s(t1,s(t2,…,tn))s(t_1, \ldots ,t_n)=s(t_1,s(t_2, \ldots ,t_n))。

给定一个数组 x1,…,xnx_1, \ldots ,x_n。任务是:对每个整数 ii(其中 0≤i<n0 \le i < n),计算从该数组中依次选取 nn 个整数(每次均可任选其中一个,允许重复) 的方案数,使得这些被选出的整数的进位制和恰好等于 ii。请将所有结果对 2582^{58} 取模后输出。

输入格式

The first line contains integer nn — the length of the array(1≤n≤1000001 \leq n \leq 100000).

The second line contains nn integers x1,…xnx_1, \ldots x_n — array elements(0≤xi<1000000 \leq x_i \lt 100000).

第一行包含一个整数 nn —— 数组的长度(1≤n≤1000001 \leq n \leq 100000)。

第二行包含 nn 个整数 x1,…,xnx_1, \ldots, x_n —— 数组元素(0≤xi<1000000 \leq x_i \lt 100000)。

输出格式

Output nn integers y0,…,yn−1y_0, \ldots, y_{n-1} — yiy_i should be equal to corresponding number of ways modulo 2582^{58}.

输出 nn 个整数 y0,…,yn−1y_0, \ldots, y_{n-1} — 其中 yiy_i 应等于对应方案数对 2582^{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)(5,5) with radix sum 00, sequence (5,6)(5,6) with radix sum 11, sequence (6,5)(6,5) with radix sum 11, sequence (6,6)(6,6) with radix sum 22.

在第一个例子中,存在以下序列:序列 (5,5)(5,5) 的基数和为 00,序列 (5,6)(5,6) 的基数和为 11,序列 (6,5)(6,5) 的基数和为 11,序列 (6,6)(6,6) 的基数和为 22。

输入解题思路,AI测评打分。不知道怎么写?

首页