No.984 Inversion
問題文最終更新日: 2020-02-11 19:01:44
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 236
(順位表)
の他の問題:
Problem Statement
You are given a prime $P$ and a natural number $N$.
Define the sequence $A$, consisting of the $P-1$ terms from the $1$-st term to the $P-1$-th term, so that the value of its $i$-th term is as follows.
- $A_i = (i \times N) \% P$
Find the remainder when the number of pairs $(i,j)$ of positive integers less than $P$ satisfying $i\lt j$ and $A_i \gt A_j$ is divided by $2$.
Input
$P\ N$
$2 \leq P \leq 2^{31}-1$
$1 \leq N \leq P-1$
$P$ is prime
All inputs are integers
Output
Output the answer on one line.
Sample
Sample 1
Input
2 1
Output
0
Sample 2
Input
7 3
Output
1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
tubuann1
beet