Task 4: MasterCoder
Task 4: MasterCoder
MasterCoder is reality tv show that sees the top 50 coders in the country battling it out for the title of MasterCoder. Coders must use their wits, knowledge, maths, and keyboard mashing abilities to survive through the MysteryProblem challenges. Each week, a coder is paired up with someone who is equally skilled. Each coder has a skill level (an integer between 1 and 9000), the higher it is, the proer he is. The producers of MasterCoder want to know how many combination of pairs of coders are possible in the first week, given a list of skill levels. Your program should read in an integer N, which indicates the number of coders in the competition. It is guaranteed that N is even.
Example:
Input:
Number of coders: 6
5 5 5 5 6 6
Output:
3
In the example above, suppose the coders are called A,B,C,D,E,F. Then, (A,B), (A,C) and (B,C) are all possible pairings because they all have skill level of 5. However, E and F are stuck with each other. The list of combinations are below:
1. (A,B) (C,D) (E,F)
2. (A,C) (B,D) (E,F)
3. (A,D) (B,C) (E,F)
Example:
Input:
Number of coders: 6
5 5 5 5 6 6
Output:
3
In the example above, suppose the coders are called A,B,C,D,E,F. Then, (A,B), (A,C) and (B,C) are all possible pairings because they all have skill level of 5. However, E and F are stuck with each other. The list of combinations are below:
1. (A,B) (C,D) (E,F)
2. (A,C) (B,D) (E,F)
3. (A,D) (B,C) (E,F)
Similar topics
» Task 2: Lightposts
» Task 6: The cake is a lie!
» Task 1: Rectangle Area
» Task 3: Cave Troll
» Task 5: As easy as bagels
» Task 6: The cake is a lie!
» Task 1: Rectangle Area
» Task 3: Cave Troll
» Task 5: As easy as bagels
Permissions in this forum:
You cannot reply to topics in this forum