103441: [Atcoder]ABC344 B - Delimiter

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

Description

Score: $150$ points

Problem Statement

You are given $N$ integers $A_1,A_2,\dots,A_N$, one per line, over $N$ lines. However, $N$ is not given in the input.
Furthermore, the following is guaranteed:

  • $A_i \neq 0$ ( $1 \le i \le N-1$ )
  • $A_N = 0$

Print $A_N, A_{N-1},\dots,A_1$ in this order.

Constraints

  • All input values are integers.
  • $1 \le N \le 100$
  • $1 \le A_i \le 10^9$ ( $1 \le i \le N-1$ )
  • $A_N = 0$

Input

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

$A_1$
$A_2$
$\vdots$
$A_N$

Output

Print $A_N, A_{N-1}, \dots, A_1$ in this order, as integers, separated by newlines.


Sample Input 1

3
2
1
0

Sample Output 1

0
1
2
3

Note again that $N$ is not given in the input. Here, $N=4$ and $A=(3,2,1,0)$.


Sample Input 2

0

Sample Output 2

0

$A=(0)$.


Sample Input 3

123
456
789
987
654
321
0

Sample Output 3

0
321
654
987
789
456
123

Input

Output

得分:150分 部分 问题描述 你得到了$N$个整数$A_1,A_2,\dots,A_N$,每个数占一行,共$N$行。但是,**输入中并没有给出$N$的值。** 此外,满足以下条件: - $A_i \neq 0$ ( $1 \le i \le N-1$ ) - $A_N = 0$ 输出$A_N, A_{N-1},\dots,A_1$,按照这个顺序。 部分 约束 - 所有输入值都是整数。 - $1 \le N \le 100$ - $1 \le A_i \le 10^9$ ( $1 \le i \le N-1$ ) - $A_N = 0$ 部分 输入 输入按照以下格式从标准输入给出: ```python $A_1$ $A_2$ $\vdots$ $A_N$ ``` 部分 输出 按照这个顺序打印$A_N, A_{N-1}, \dots, A_1$,每个数占一行。 部分 样例输入1 ``` 3 2 1 0 ``` 部分 样例输出1 ``` 0 1 2 3 ``` 再次注意,输入中并没有给出$N$的值。 这里,$N=4$,$A=(3,2,1,0)$。 部分 样例输入2 ``` 0 ``` 部分 样例输出2 ``` 0 ``` $A=(0)$。 部分 样例输入3 ``` 123 456 789 987 654 321 0 ``` 部分 样例输出3 ``` 0 321 654 987 789 456 123 ```

加入题单

算法标签: