Author: Andrew Seidel
At the local candy factory, every Tuesday, there is a contest for whoever can come up with the best new chocolate. To make a decision on whether or not each chocolate is a winner, there is a panel of impartial judges that come in from the community. The judges are given the following criteria for judging:
- Packaging (
), up to point - Flavour (
), up to points - Minimal ingredients (
), up to points
A score
Your task is to declare the winner based on the highest total score in the competition. If there is a tie for the highest total score, it can sometimes be broken using the total scores for
The competition is not really fair because some chocolates get more judges than others. But that's life at the candy factory.
Input Specification
The input will contain J
followed by the *
(ASCII
Output Specification
Output the name of the winner. If there is more than one winner, print out all winners on a single line separated by commas (order does not matter — i.e., an output of A,B
is the same as B,A
).
Sample Input 1
2
C1
J 0 1 1
J 0 1 0
J 1 0 0
C2
J 1 2 3
*
Sample Output 1
C2
Note: Only
Sample Input 2
4
ChocolateOfChocolates
J 0 2 2
J 0 1 2
J 1 2 0
Choco-Fun
J 1 2 3
J 1 2 0
ChocolateHaven
J 1 2 0
J 0 2 3
J 1 0 1
ChocolatesRock
J 1 2 1
J 1 2 0
J 1 2 0
*
1
ChocolateFilledCandy
J 0 0 0
*
Sample Output 2
ChocolateOfChocolates
ChocolateFilledCandy
Note: Only
Explanation of Sample 2
For the first competition, there is a tie between ChocolateOfChocolates
, ChocolateHaven
, and ChocolatesRock
. We then had to look at the ChocolateOfChocolates
and ChocolateHaven
. Consequently, we had to then check the ChocolateOfChocolates
has the higher value.
ECOO 2017 Question Development Team
Kevin Forest ............................................... Sheridan College
John Ketelaars ....................................... ECOO-CS Communications
Stella Lau .......................................... University of Cambridge
Greg Reid .................. St. Francis Xavier Secondary School, Mississauga
Sam Scott .................................................... Mohawk College
Andrew Seidel ..................... John Fraser Secondary School, Mississauga
David Stermole ............................................ ECOO-CS President
Reyno Tilikaynen ..................................... University of Waterloo
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments