34 人解决,41 人已尝试。
48 份提交通过,共有 153 份提交。
4.2 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
In the game of Musical Chairs, $n$ players walk around a circle of $n-1$ chairs while music plays on the stereo. When the music stops, everyone hurries to claim a chair. The player who is left standing gets knocked out of the game.
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 $i$-th character of chairs corresponds to the $i$-th element of playerNames. For instance, the chairs might be arranged as follows.
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 $N$ ($2 \le N \le 50$) of playerNames.
Then following $N$ lines. In each line there is a string stand for one people’s name in the order discribe above.Each element of playerNames will contain between $1$ and $50$ characters, inclusive, and contain only letters (‘A’-‘Z’, ‘a’-‘z’) and spaces (‘ ‘).
$N+2$ line is the string of chairs, it will contain the same number of characters as the number of elements in playerNames. Exactly one character in chairs will be .
, and all the other characters will be h
.
$N+3$ line is an interger seconds, will be between $0$ and $600$, inclusive.
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