FoxAndGame
SRM 571 · 2012-12-13 · by cgy4ever
SRM 571 · 2012-12-13 · by cgy4ever · Brute Force
Problem Statement
Problem Statement
Fox Ciel is playing the popular game 'Cut the Rope' on her smartphone.
The game has multiple stages, and for each stage the player can gain between 0 and 3 stars, inclusive.
You are given a String[] result containing Fox Ciel's current results:
For each stage, result contains an element that specifies Ciel's result in that stage.
More precisely, result[i] will be "---" if she got 0 stars in stage i, "o--" if she got 1 star, "oo-" if she got 2 stars and "ooo" if she managed to get all 3 stars.
Return the total number of stars Ciel has at the moment.
Constraints
- result will contain between 1 and 50 elements, inclusive.
- Each element in result will be one of "---", "o--", "oo-", "ooo".
Examples
0)
{"ooo",
"ooo"}
Returns: 6
There are two stages. In each of them, Ciel got all three stars. Together, she now has 3+3 = 6 stars.
1)
{"ooo",
"oo-",
"o--"}
Returns: 6
This time the answer is 3 + 2 + 1 = 6.
2)
{"ooo",
"---",
"oo-",
"---",
"o--"}
Returns: 6
3)
{"o--",
"o--",
"o--",
"ooo",
"---"}
Returns: 6
4)
{"---",
"o--",
"oo-",
"ooo",
"ooo",
"oo-",
"o--",
"---"}
Returns: 12
Submissions are judged against all 113 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class FoxAndGame with a public method int countStars(vector<string> result) · 113 test cases · 2 s / 256 MB per case