A15877 | Combinatorics Problem
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Recall that the binomial coefficient $\binom{x}{y}$ is calculated as follows ( $x$ and $y$ are non-negative integers):
- if $x < y$ , then $\binom{x}{y} = 0$ ;
- otherwise, $\binom{x}{y} = \frac{x!}{y! \cdot (x-y)!}$ .
You are given an array $a_1, a_2, \dots, a_n$ and an integer $k$ . You have to calculate a new array $b_1, b_2, \dots, b_n$ , where
- $b_1 = (\binom{1}{k} \cdot a_1) \bmod 998244353$ ;
- $b_2 = (\binom{2}{k} \cdot a_1 + \binom{1}{k} \cdot a_2) \bmod 998244353$ ;
- $b_3 = (\binom{3}{k} \cdot a_1 + \binom{2}{k} \cdot a_2 + \binom{1}{k} \cdot a_3) \bmod 998244353$ , and so on.
Formally, $b_i = (\sum\limits_{j=1}^{i} \binom{i - j + 1}{k} \cdot a_j) \bmod 998244353$ .
Note that the array is given in a modified way, and you have to output it in a modified way as well.
- if $x < y$ , then $\binom{x}{y} = 0$ ;
- otherwise, $\binom{x}{y} = \frac{x!}{y! \cdot (x-y)!}$ .
You are given an array $a_1, a_2, \dots, a_n$ and an integer $k$ . You have to calculate a new array $b_1, b_2, \dots, b_n$ , where
- $b_1 = (\binom{1}{k} \cdot a_1) \bmod 998244353$ ;
- $b_2 = (\binom{2}{k} \cdot a_1 + \binom{1}{k} \cdot a_2) \bmod 998244353$ ;
- $b_3 = (\binom{3}{k} \cdot a_1 + \binom{2}{k} \cdot a_2 + \binom{1}{k} \cdot a_3) \bmod 998244353$ , and so on.
Formally, $b_i = (\sum\limits_{j=1}^{i} \binom{i - j + 1}{k} \cdot a_j) \bmod 998244353$ .
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$ , $a_1$ , $x$ , $y$ , $m$ and $k$ ( $1 \le n \le 10^7$ ; $0 \le a_1, x, y < m$ ; $2 \le m \le 998244353$ ; $1 \le k \le 5$ ).
The array $[a_1, a_2, \dots, a_n]$ is generated as follows:
- $a_1$ is given in the input;
- for $2 \le i \le n$ , $a_i = (a_{i-1} \cdot x + y) \bmod m$ .
The array $[a_1, a_2, \dots, a_n]$ is generated as follows:
- $a_1$ is given in the input;
- for $2 \le i \le n$ , $a_i = (a_{i-1} \cdot x + y) \bmod m$ .
输出格式
Since outputting up to $10^7$ integers might be too slow, you have to do the following:
Let $c_i = b_i \cdot i$ (without taking modulo $998244353$ after the multiplication). Print the integer $c_1 \oplus c_2 \oplus \dots \oplus c_n$ , where $\oplus$ denotes the bitwise XOR operator.
Let $c_i = b_i \cdot i$ (without taking modulo $998244353$ after the multiplication). Print the integer $c_1 \oplus c_2 \oplus \dots \oplus c_n$ , where $\oplus$ denotes the bitwise XOR operator.
输入输出样例
输入 #1
5 8 2 3 100 2
输出 #1
1283
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted