103560: [Atcoder]ABC356 A - Subsegment Reverse
Description
Score : $100$ points
Problem Statement
You are given positive integers $N$, $L$, and $R$.
For a sequence $A = (1, 2, \dots, N)$ of length $N$, an operation of reversing the $L$-th through $R$-th elements was performed once.
Print the sequence after this operation.
Constraints
- All input values are integers.
- $1 \leq L \leq R \leq N \leq 100$
Input
The input is given from Standard Input in the following format:
$N$ $L$ $R$
Output
Let $A' = (A'_1, A'_2, \dots, A'_N)$ be the sequence after the operation. Print it in the following format:
$A'_1$ $A'_2$ $\dots$ $A'_N$
Sample Input 1
5 2 3
Sample Output 1
1 3 2 4 5
Initially, $A = (1, 2, 3, 4, 5)$.
After reversing the second through third elements, the sequence becomes $(1, 3, 2, 4, 5)$, which should be printed.
Sample Input 2
7 1 1
Sample Output 2
1 2 3 4 5 6 7
It is possible that $L = R$.
Sample Input 3
10 1 10
Sample Output 3
10 9 8 7 6 5 4 3 2 1
It is possible that $L = 1$ or $R = N$.
Output
问题描述
你被给出了正整数 $N$,$L$ 和 $R$。
对于长度为 $N$ 的序列 $A = (1, 2, \dots, N)$,已经执行了一次将第 $L$ 项到第 $R$ 项的元素反转的操作。
请打印出操作后序列的值。
限制条件
- 所有输入值都是整数。
- $1 \leq L \leq R \leq N \leq 100$
输入
输入通过标准输入给出以下格式:
$N$ $L$ $R$
输出
令 $A' = (A'_1, A'_2, \dots, A'_N)$ 为操作后的序列。按照以下格式打印它:
$A'_1$ $A'_2$ $\dots$ $A'_N$
样例输入1
5 2 3
样例输出1
1 3 2 4 5
最初,$A = (1, 2, 3, 4, 5)$。
在反转第二项到第三项之后,序列变为 $(1, 3, 2, 4, 5)$,应打印这个序列。
样例输入2
7 1 1
样例输出2
1 2 3 4 5 6 7
可能出现 $L = R$ 的情况。
样例输入3
10 1 10
样例输出3
10 9 8 7 6 5 4 3 2 1
可能出现 $L = 1$ 或 $R = N$ 的情况。
Sample Input Copy
Sample Output Copy