题库练习 「2020-2021 集训队作业」Permutation
← 上一题 下一题 →

A5943 | 「2020-2021 集训队作业」Permutation

时间限制1s
内存限制512MB
通过 / 提交0/0

题目描述

给出 $n,P$,设

$$ f_n = \left(\sum_{p\text{ is a permutation of length }n} [\exists i \in [1,n] , p_i = i][\exists i \in [1,n] , p_i = n - i + 1]\right) \bmod\ P $$

你需要求出 $\bigoplus_{i=1}^n f_i$ 的值。

输入格式

输入一行两个整数 $n,P$。

输出格式

一行一个整数表示答案。

输入输出样例

输入 #1
2 100000
输出 #1
1
C++ 编辑器
输入
输出