当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3379:Alphabet

题目描述

Johnny is a little boy, and now he is learning alphabet. His father made him a birthday present — a large collection of tokens, each marked with a letter from ‘A’ to ‘Z’, and Johnny invented an interesting game to help himself learning.

First, Johnny takes several tokens and puts them in a circle. After that he selects one of the tokens to start the game at, and chooses some number k. Each turn Johnny counts k tokens along the circle to find the next winning token and inserts another token to the circle immediately after it. This new token must hold the letter which follows alphabetically the letter written on the winning token, i.e. ‘B’ is inserted if the winning token is ‘A’, ‘C’ is inserted after ‘B’, etc. If the winning token is ‘Z’, the token ‘A’ is inserted. There are so many tokens available that Johnny can always find one with the required letter.

After inserting the token Johnny proceeds to another game turn, this time starting from the newly inserted token. The number k is only selected once and is not changed between turns. The first four turns of a sample game with initial tokens ‘J’, ‘O’, ‘H’, ‘N’, ‘N’, ‘Y’ (‘J’ is the starting one) and k = 3 are shown on a figure below:

Georgie is Johnny’s elder brother. Since he is already a schoolboy, he plays the same game mentally and astonishes Johnny with his ability to predict the letter inserted at turn i. But as Johnny gets smarter and makes more and more turns, it becomes harder for Georgie to compete, so he decides to write a computer program to find the results quickly.

输入解释

The first line of the input file contains three integers: n — the number of tokens initially placed in a circle (1 ≤ n10 000), k — the number of tokens counted each turn (1 ≤ k10 000), and m — the number of turns (1 ≤ m ≤ 109).

The second line contains a string of n uppercase letters (‘A’ to ‘Z’) — the tokens initially placed in a circle, starting from the initial token.

输出解释

Output a single uppercase English letter which is added to the circle at the m-th turn.

输入样例
6 3 4
JOHNNY
输出样例
Z

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3379

最后修改于 2020-10-29T07:00:08+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536