A stadium turnstile dispenses sequentially numbered tickets. It is initialized with a starting value n: the very first press of the turnstile hands out ticket number n itself, and every press after that hands out a ticket exactly one greater than the previous ticket handed out — the turnstile never resets and never skips a number. Given the starting value and the number of times the turnstile is pressed in a row, report the ticket number produced by each press, in order.
A single line with two integers n and q — the starting ticket value and the number of consecutive presses.
A single line with q integers, separated by single spaces: the ticket number dispensed on the 1st press, the 2nd press, ..., the q-th press, in that order.
0 <= n <= 10001 <= q <= 1000Example 1
Input
5 3
Expected
5 6 7
Explanation
The turnstile starts at n = 5. The first press dispenses 5 itself (no increment yet). The second press dispenses one more than the previous ticket, 6. The third press dispenses one more again, 7. Output: 5 6 7.
Example 2
Input
0 1
Expected
0
Explanation
The turnstile starts at n = 0 and is pressed only once, so the single press dispenses the starting value itself with no increment applied. Output: 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →