No.1409 Simple Math in yukicoder
タグ : / 解いたユーザー数 57
作問者 :
PCTprobability
/ テスター :
akakimidori
kaage
Problem Statement
You are given positive integers $v,x$. It is guaranteed that $xv+1$ is prime. Find $1$ sequence of positive integers $a_1,a_2,...,a_x$ satisfying the following conditions.
- $1$ $\le$ $a_1$ $<$ $a_2$ $<$ $...$ $<$ $a_x$ $\le$ $xv$
- For every positive integer $k$ at least $1$ and less than $x$, \( \displaystyle \sum_{i=1}^{x}a_i^k \) is divisible by $xv+1$.
- \( \displaystyle \sum_{i=1}^{x}a_i^x \) leaves a remainder of $x$ when divided by $xv+1$.
Output any valid sequence $a$, separated by spaces. It is guaranteed that a solution always exists.
In this problem, $T$ test cases are given.
Input
$T$Each test case is given in the following format.
テストケース $1$
テストケース $2$
$.$$.$$.$
テストケース $T$
$v$ $x$
- All inputs are positive integers.
- $1 \le T,v \le 1000$
- $1 \le x \le 100$
- $xv+1$ is prime.
Output
Output $T$ lines. On the $i$-th line, output the answer for test case $i$.
Sample
Sample 1
Input
1
1 2
Output
1 2
In this case, $xv+1=3$. Here, $a_1=1,a_2=2$ is a solution, since it satisfies $1 \le a_1 < a_2 \le 2$, $1+2≡0 \bmod 3$, and $1^2+2^2≡2 \bmod 3$.
Sample
Sample 1
Input
3 2 6 2 1 6 7
Output
1 3 4 9 10 12 1 1 4 11 16 21 35 41
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。