Problem 2736 --String - Shuffle

2736: String - Shuffle

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $97$ 正确数量 $68$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL 字符串

Shuffle 

Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. 

A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. 

The deck of cards is represented by a string as follows.

abcdeefab 

The first character and the last character correspond to the card located at the bottom of the deck and the card on the top of the deck respectively. 

For example, a shuffle with h = 4 to the above deck, moves the first 4 characters "abcd" to the end of the remaining characters "eefab", and generates the following deck: 

eefababcd 

You can repeat such shuffle operations. 

Write a program which reads a deck (a string) and a sequence of h, and prints the final state (a string).

The input consists of multiple datasets. Each dataset is given in the following format: 

A string which represents a deck 

The number of shuffle m 

h1 

h2 

 . 

 . 

hm 

The input ends with a single character '-' for the string.

For each dataset, print a string which represents the final state in a line.
aabc
3
1
2
1
vwxyz
2
3
4
-
aabc
xyzvw

The length of the string ≤ 200 

1 ≤ m ≤ 100 

1 ≤ hi < The length of the string 

The number of datasets ≤ 10

推荐代码 查看2736 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 每天一图灵 807061 2022-01-05 23:29:24
内存最少[$0 $KB] 我还小可以上去插队吗 554199 2019-12-15 18:16:00
第一AC Dream_Master 332190 2018-11-27 10:15:23
第一挑战 Dream_Master 332189 2018-11-27 10:14:05

赛题来源/所属竞赛 会津大学《C++ Programming I》 C++程序设计(入门)

竞赛编号 竞赛名称 竞赛时间 访问比赛
1676 2021-2022-1学期《程序设计技能实训》字符串和指针【21计算机1234班】 2021-12-14 07:00:00 请登录
1489 2019年安徽科技学院《ACM程序设计》第50周赛 2019-12-15 16:00:00 请登录
1488 2019-2020-1学期《C语言程序设计技能实训》第三场:字符串和指针【19计算机12班】 2019-12-04 22:00:00 请登录