Statistics

Problem Statement for "Language"

Problem Statement

PROBLEM STATEMENT

amhcxa is a TopCoder member and he just entered a room for a single round match
98. He knows everybody in the room. He also knows the programming language each
person in the room uses. amhcxa himself programs equally bad in Java or C++.
Namely, he often submits incorrect code. He wants to pick a programming
language for today's match to minimize the number of people in the room who
would read his code during the challenge phase (he doesn't want to give people
an extra opportunity to get challenge points).

In more detail:
- He knows that everybody starts reading source code from the bottom of the
room up (that means everybody hopes that the weakest person in the room has the
biggest probability of making a mistake)
- He knows that everybody will submit something
- He knows that everybody reads source code only if it is written in the same
programming language as they use to code themselves, otherwise they skip it
- He knows that everybody spends exactly five minutes reading a single person's
code.
- He knows that the challenge phase takes exactly 15 minutes (that is, each
person has time to read the code of exactly three people).
- He knows that people do not examine their own code

COMMENT
This problem was created before C# was allowed at TopCoder. Assume no one in
the room codes in C#.

Your task is, given a list of how programming languages are distributed in the
room from top to bottom and the place where amhcxa fits in the list, return a
String formatted "<language> <n>/<m>", where <language> represents "Java",
"C++" or "Whatever"; <n> represents how many people will check amhcxa's code if
he chooses Java and <m> represents how many people will check his code if he
chooses C++. <language> should be "Java" when <n> is less than <m>, "C++" when
<n> is more than <m>, and "Whatever" when <m> is equal to <n>. Between
<language> and <n> should be exactly one space (and there should not be other
spaces than that), between <n> and <m> should be the character '/'.
 
DEFINITION
Class: Language
Method: choose
Parameters: String[]
Returns: String
Method signature (be sure your method is public):  String choose(String[]
languages);
 
TopCoder will ensure the validity of the inputs. Inputs are valid if all of the
following criteria are met: 
- languages will contain between 8 to 10 elements inclusive
- each element of languages is one of: "Java", "C++", "amhcxa"
- exactly one element of languages equals "amhcxa"

NOTE 
languages is sorted in descending order with respect to rating: the first
element of languages is the language used by the highest ranked player in the
room, the second element of languages is the language used by the
second-highest ranked player in the room etc. That is, competitors would start
checking code from the last element of the languages.		
 
EXAMPLES
1. languages = {"amhcxa", "Java", "Java", "Java", "Java", "C++", "C++", "C++",
"C++"} return "Whatever 0/0" as nobody would have time to read amhcxa's code.

2. languages = {"amhcxa", "Java", "Java", "Java", "Java", "Java", "Java",
"Java", "C++", "C++"} return "Java 0/2".

3. languages = {"C++", "Java", "Java", "Java", "Java", "Java", "Java", "C++",
"amhcxa"} return "C++ 6/2".

4. languages = {"Java", "Java", "Java", "Java", "amhcxa", "C++", "C++", "C++",
"C++", "C++"} return "C++ 4/0".

Definition

Class:
Language
Method:
choose
Parameters:
String[]
Returns:
String
Method signature:
String choose(String[] param0)
(be sure your method is public)

Constraints

    Examples


      This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
      This problem was used for: