102780: [AtCoder]ABC278 A - Shift

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:3 Solved:0

Description

Score : $100$ points

Problem Statement

You are given a sequence $A = (A_1, A_2, \dots, A_N)$ of length $N$.
You perform the following operation exactly $K$ times:

  • remove the initial element of $A$ and append a $0$ to the tail of $A$.

Print all the elements of $A$ after the operations.

Constraints

  • $1 \leq N \leq 100$
  • $1 \leq K \leq 100$
  • $1 \leq A_i \leq 100$
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

$N$ $K$
$A_1$ $A_2$ $\dots$ $A_N$

Output

Print the elements of $A$ after the operations in one line, separated by spaces.


Sample Input 1

3 2
2 7 8

Sample Output 1

8 0 0

Before the operations, $A = (2, 7, 8)$.
After performing the operation once, $A = (7, 8, 0)$.
After performing the operation twice, $A = (8, 0, 0)$.
Thus, $(8, 0, 0)$ is the answer.


Sample Input 2

3 4
9 9 9

Sample Output 2

0 0 0

Sample Input 3

9 5
1 2 3 4 5 6 7 8 9

Sample Output 3

6 7 8 9 0 0 0 0 0

Input

题意翻译

给定一个有 $n$ 个整数的数组 $a$,要求进行以下 $k$ 次操作,输出操作后的数组。 操作为:将第一个数去掉,在队尾加上一个 $0$。 translate by [PineappleSummer](https://www.luogu.com.cn/user/880187)

Output

分数:100分

问题描述

给你一个长度为$N$的序列$A = (A_1, A_2, \dots, A_N)$。
你将执行以下操作恰好$K$次:

  • 从$A$的头部移除一个元素,并在$A$的尾部追加一个0。

输出操作后$A$的所有元素。

限制条件

  • $1 \leq N \leq 100$
  • $1 \leq K \leq 100$
  • $1 \leq A_i \leq 100$
  • 输入中的所有值都是整数。

输入

输入从标准输入按以下格式给出:

$N$ $K$
$A_1$ $A_2$ $\dots$ $A_N$

输出

在一行内输出操作后$A$的所有元素,元素之间用空格分隔。


样例输入1

3 2
2 7 8

样例输出1

8 0 0

在操作之前,$A = (2, 7, 8)$。
执行一次操作后,$A = (7, 8, 0)$。
执行两次操作后,$A = (8, 0, 0)$。
因此,$(8, 0, 0)$是答案。


样例输入2

3 4
9 9 9

样例输出2

0 0 0

样例输入3

9 5
1 2 3 4 5 6 7 8 9

样例输出3

6 7 8 9 0 0 0 0 0

加入题单

算法标签: