CF1832E.Combinatorics Problem
普及/提高-
通过率:0%
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.
输入格式
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 .
输出格式
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.
输入输出样例
输入#1
5 8 2 3 100 2
输出#1
1283