当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2481:Toy

题目描述
On birthday, Anthony got a toy. It is constructed with N+1(N>=3) balls and 2*N sticks. All balls are in a same plane. One of them is special, while the other N balls are connected to it by N sticks with the same length. The angles between any two adjacent sticks are equal. And finally, any two adjacent balls(except the central one) are connected by a stick.
  Here are two examples:

Anthony wanted to remove N sticks, leaving all balls still connected. He wanted to know the number of all legal solutions. Your task is to solve this problem for him.
  Notice that if a solution will be the same as another one by rotation, these two solutions should be consider as the same.
The answer may be quite large. You just need to calculate the remainder of the answer when divided by M.
输入解释
Input contains several test cases.
For each test case, there is only one line containing two integers N and M(3<=N<=10^9, 2<=M<=10^9).
Input is terminated by EOF.
输出解释
For each case, output one integer in one line, representing the remainder of the number of all solutions when divided by M.

输入样例
3 10000
4 10000
4 10
输出样例
6
13
3
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-2481

最后修改于 2020-10-25T22:53:51+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 32768/32768K(Java/Others)