8 人解决,13 人已尝试。
11 份提交通过,共有 28 份提交。
6.6 EMB 奖励。
单点时限: 5.0 sec
内存限制: 256 MB
Neverland is compounded by many communities of lost kids. These communities can have one or more kids and/or a nested community (only 1) and that nested community can have one or more kids and/or a nested community (only 1), etc.
Peter Pan decided to celebrate a national championship of “Rock-paper-scissors”. Due the nation is really big he implemented a Web application to set the information. (Only to get the information) from all the kids.
The form requests the following information:
The Web application wills export all the information in a String with the following syntax:
[(Name-Main Weapon-Secondary Weapon)(Name-Main Weapon-Secondary Weapon)]
Example
[(Michael-P-S)(John-P-R)[(Peter-P-R)(Campanita-S-P)](Guillermo-R-R)]
Where
() = A kid
[] = Community with two of more kids and also can contain a nested community (Only
one is valid)
S = Scissors
P = Paper
R = Rock
Example Explanation
Requirement
Develop a program that get the String generated by the Web Application and process the games (see rules) to provide a general Champion of Neverland.
Game Rules
Only kids can play (sub-communities are not valid)
Only two kids can play at the same time.
If a community have a nested community, the games of the nested community must start first
The winner of a nested community must play with the first kid left to right.
A kid can use the same weapon for main and secondary choices
The kids will always use the same main weapon for all their games. (Exceptions will be described in rule 7).
If both players (P1, P2) have the same weapon, to avoid a draw they need to use
secondary weapons in the following order:
see above~ One case per line.
see above~ Each case is separated by a blank line.
[[(Michael-P-S)(John-P-R)[(Peter-P-R)(Campanita-S-P)]](Wendy-S-S)(Guillermo-R-R)]
Peter, Weapon: P VS Campanita, Weapon: S Won: Campanita Campanita, Weapon: S VS Michael, Weapon: P Won: Campanita Campanita, Weapon: S VS John, Weapon: P Won: Campanita Campanita, Weapon: P VS Wendy, Weapon: S Won: Wendy Wendy, Weapon: S VS Guillermo, Weapon: R Won: Guillermo Final Winner: (Guillermo-R-R)
8 人解决,13 人已尝试。
11 份提交通过,共有 28 份提交。
6.6 EMB 奖励。