#abc258c. C - Rotation
C - Rotation
Score : points
问题描述
你将获得两个正整数 和 ,以及一个长度为 的由小写英文字母组成的字符串 。
处理 个查询。每个查询属于以下两种类型之一。
1 x
: 依次执行 次以下操作:删除 的最后一个字符,并将其添加到开头。2 x
: 输出 的第 个字符。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given positive integers and , and a string of length consisting of lowercase English letters.
Process queries. Each query is of one of the following two types.
1 x
: Perform the following times in a row: delete the last character of and append it to the beginning.2 x
: Print the -th character of .
Constraints
- consists of lowercase English letters.
- At least one query in the format
2 x
. - , , are all integers.
Input
Input is given from Standard Input in the following format:
Each query is in the following format, where is or :
Output
For each query in the format 2 x
, print the answer in a single line.
Sample Input 1
3 3
abc
2 2
1 1
2 2
Sample Output 1
b
a
In the -st query, is abc
, so the -nd character b
should be printed. In the -nd query, is changed from abc
to cab
. In the -rd query, is cab
, so the -nd character a
should be printed.
Sample Input 2
10 8
dsuccxulnl
2 4
2 7
1 2
2 7
1 1
1 2
1 3
2 5
Sample Output 2
c
u
c
u
update @ 2024/3/10 10:57:21