34 人解决,41 人已尝试。
48 份提交通过,共有 153 份提交。
4.2 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
In the game of Musical Chairs,
You are given a playerNames-list which containing the names of the players, ordered according to their position at the start of the game, such as the following.
“Emma Sue”, “Billy Bob Thornton”, “Joe”, “Cassius Clay”
You are also given a string chairs describing the arrangement of chairs with an h
(lowercase letter H) for each chair and exactly one .
(period) indicating a gap. The
hh.h
The player by the gap is the one who gets knocked out. For example, if the four players above are in their starting order when the music stops, then Joe gets knocked out. For each second of music, the players advance one position. From the original order shown above, for example, the players’ order changes to the following after one second.
“Cassius Clay”, “Emma Sue”, “Billy Bob Thornton”, “Joe”
Given an int seconds specifying the number of seconds that the music is played, return the name of the player who gets knocked out.
There may be multiple testcase. Process till the end of file.
Each data set start with a single number stand for the number
Then following
.
, and all the other characters will be h
.
For each test case output a single line, the name of the player who gets knocked out.
There are no extra blank lines between testcases.
4 Emma Sue Billy Bob Thornton Joe Cassius Clay hh.h 1 4 Emma Sue Billy Bob Thornton Joe Cassius Clay hh.h 4 6 Jack Dempsey Joe Louis Rocky Marciano Cassius Clay George Foreman Mike Tyson h.hhhh 500
Billy Bob Thornton Joe Mike Tyson