#abc256g. G - Black and White Stones
G - Black and White Stones
Score : points
问题描述
存在一个边长为 的正 边形。
从一个顶点出发,我们在圆周上每隔 个单位放置黑色或白色的石子。因此,每个 边形的边将会有 个石子,总共放置 个石子。
有多少种方法可以放置石子,使得所有边上的白色石子数量相同?请在模 的意义下求出方案数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a regular -gon with side length .
Starting from a vertex, we place black or white stones on the circumference at intervals of . As a result, each edge of the -gon will have stones on it, for a total of stones.
How many ways are there to place stones so that all edges have the same number of white stones on them? Find the count modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 2
Sample Output 1
10
There are ways, as follows:
Sample Input 2
299792458 3141
Sample Output 2
138897974
Find the count modulo .
update @ 2024/3/10 10:54:20