codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1409C.md (1917B)


      1 Source: https://codeforces.com/problemset/problem/1409/C
      2 
      3 C. Yet Another Array Restoration
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 We have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array:
     22 
     23 * The array consists of $n$ distinct positive (greater than $0$) integers.
     24 * The array contains two elements $x$ and $y$ (these elements are known for you) such that $x \lt y$.
     25 * If you sort the array in increasing order (such that $a_1 \lt a_2 \lt \ldots \lt a_n$), differences between all adjacent (consecutive) elements are equal (i.e. $a_2 - a_1 = a_3 - a_2 = \ldots = a_n - a_{n-1})$.
     26 
     27 It can be proven that such an array always exists under the constraints given below.
     28 
     29 Among all possible arrays that satisfy the given conditions, we ask you to restore one which has the minimum possible maximum element. In other words, you have to minimize $\max(a_1, a_2, \dots, a_n)$.
     30 
     31 You have to answer $t$ independent test cases.
     32 
     33 Input
     34 
     35 The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases. Then $t$ test cases follow.
     36 
     37 The only line of the test case contains three integers $n$, $x$ and $y$ ($2 \le n \le 50$; $1 \le x \lt y \le 50$) — the length of the array and two elements that are present in the array, respectively.
     38 
     39 Output
     40 
     41 For each test case, print the answer: $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the $i$-th element of the required array. If there are several answers, you can print any (it also means that the order of elements doesn't matter).
     42 
     43 It can be proven that such an array always exists under the given constraints.
     44 
     45 Example
     46 
     47 Input
     48 
     49 ```
     50 5
     51 2 1 49
     52 5 20 50
     53 6 20 50
     54 5 3 8
     55 9 13 22
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 1 49 
     62 20 40 30 50 10
     63 26 32 20 38 44 50 
     64 8 23 18 13 3 
     65 1 10 13 4 19 22 25 16 7
     66 ```