Practice

Dropped-Score Qualifier

2025/Oct/Nov·Variant 1·Q11·[15 marks]
HARD2D Arrays

Three named competitors each complete 4 rounds. Read the names, then a score from 0 to 30 for every competitor in every round (re-read until valid).

For each competitor, drop their highest round and their lowest round, then total the two remaining scores:

  • qualified if the remaining total is 40 or more
  • reserve if it is 30 to 39 inclusive
  • not qualified otherwise

Output each name with their category, then the three category counts.

Input: 3 names, then 12 scores in competitor-major order. Output: Three result lines, then three count lines.

Example:

Input:  Ann
        Ben
        Cat
        30
        30
        20
        20
        10
        10
        10
        10
        15
        15
        15
        15
Output: Ann qualified
        Ben not qualified
        Cat reserve
        Qualified: 1
        Reserve: 1
        Not qualified: 1

Sample Test Cases

Test 1: One of each category
Inputs: Ann, Ben, Cat, 30, 30, 20, 20, 10, 10, 10, 10, 15, 15, 15, 15
Expected: Ann qualified Ben not qualified Cat reserve Qualified: 1 Reserve: 1 Not qualified: 1
Test 2: Negative score rejected, then Jo 60 / Mo 0 / Bo 30 after drops
Inputs: Jo, Mo, Bo, -1, 30, 30, 30, 30, 0, 0, 0, 0, 15, 15, 15, 15
Expected: Jo qualified Mo not qualified Bo reserve Qualified: 1 Reserve: 1 Not qualified: 1