CF1832E.Combinatorics Problem
提高+/省选-
通过率:0%
时间限制:4.00s
内存限制:1024MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Recall that the binomial coefficient (yx) is calculated as follows (x and y are non-negative integers):
- if x<y, then (yx)=0;
- otherwise, (yx)=y!⋅(x−y)!x!.
You are given an array a1,a2,…,an and an integer k. You have to calculate a new array b1,b2,…,bn, where
- b1=((k1)⋅a1)mod998244353;
- b2=((k2)⋅a1+(k1)⋅a2)mod998244353;
- b3=((k3)⋅a1+(k2)⋅a2+(k1)⋅a3)mod998244353, and so on.
Formally, bi=(j=1∑i(ki−j+1)⋅aj)mod998244353.
Note that the array is given in a modified way, and you have to output it in a modified way as well.
回忆一下,二项式系数 (yx) 的计算方式如下(其中 x 和 y 为非负整数):
- 若 x<y,则 (yx)=0;
- 否则,(yx)=y!⋅(x−y)!x!。
给定一个数组 a1,a2,…,an 和一个整数 k。你需要计算一个新数组 b1,b2,…,bn,其中
- b1=((k1)⋅a1)mod998244353;
- b2=((k2)⋅a1+(k1)⋅a2)mod998244353;
- b3=((k3)⋅a1+(k2)⋅a2+(k1)⋅a3)mod998244353,依此类推。
形式化地,bi=(j=1∑i(ki−j+1)⋅aj)mod998244353。
注意:输入数组以一种修改后的方式给出,且你输出的数组也需采用相同的修改方式。
输入格式
The only line of the input contains six integers n, a1, x, y, m and k (1≤n≤107; 0≤a1,x,y<m; 2≤m≤998244353; 1≤k≤5).
The array [a1,a2,…,an] is generated as follows:
- a1 is given in the input;
- for 2≤i≤n, ai=(ai−1⋅x+y)modm.
输入仅包含一行,其中有六个整数 n、a1、x、y、m 和 k(满足 1≤n≤107;0≤a1,x,y<m;2≤m≤998244353;1≤k≤5)。
数组 [a1,a2,…,an] 按如下方式生成:
- a1 由输入给出;
- 对于 2≤i≤n,有 ai=(ai−1⋅x+y)modm。
输出格式
Since outputting up to 107 integers might be too slow, you have to do the following:
Let ci=bi⋅i (without taking modulo 998244353 after the multiplication). Print the integer c1⊕c2⊕⋯⊕cn, where ⊕ denotes the bitwise XOR operator.
由于输出最多 107 个整数可能过于耗时,你需要执行以下操作:
令 ci=bi⋅i(乘法后不取模 998244353)。输出整数 c1⊕c2⊕⋯⊕cn,其中 ⊕ 表示按位异或运算符。
输入输出样例
输入#1
5 8 2 3 100 2
输出#1
1283
输入解题思路,AI测评打分。不知道怎么写?