#awa0005. Pure Memory
Pure Memory
Pure Memory
Background
$\texttt{An intense dissatisfaction with the world.}$
$\texttt{And a compulsion to do something about it.}$
Description
形式化的讲, 需要你求出
的值,其中, 为数列。
对于 ,有
其中的 满足
$$\forall\ i \in [l + 1, r - 1], a_{i-1} + a_{i+1}=2a_i $$对于长度为 的整数数列 ,有
$$a_i=\left\lfloor\dfrac{n\bmod p^i}{p^{i-1}}\right\rfloor $$Sample Input & Output
读入一行 。
输出一行,见简化题意。
5 3
8
998244353 19
131122467
98 10
187
1145141919810 60
302077622
Data Range
对于 的数据,;
对于 的数据,;
对于另外 的数据,;
对于 的数据,。
Tips
- 请注意到本题 并不正常 的空间限制。
- 仅保证时间限制在 std 的 倍以上(卡常后)。
- 如果需要,请使用:
#pragma GCC optimize(2)
于代码第一行。
相关
在下列比赛中: