Implement a function that determines how many people in a group are wealthier than the richest member of another group, and return the average number of wealthier individuals per person in that second group.
Functionality
The function count_wealthier_in_group takes two parameters:
An integer T representing the number of test cases.
A list of test_cases, where each test_case is a tuple containing:
nR: an integer representing the number of individuals in the first group.
nG: an integer representing the number of individuals in the second group.
wealth: a list of integers representing the wealth of individuals in the first group.
For each test case:
Identify the wealth of the richest individual in the first group.
Count how many individuals in the first group have wealth greater than this maximum wealth.
Divide this count by the number of individuals in the second group (nG) and append the integer result to the results list.
The function should return a list of integers corresponding to each test case.
Input/Output Requirements
Input:
T: (1 <= T <= 1000), the number of test cases.
test_cases: A list of T tuples, each containing:
nR: (1 <= nR <= 100), the number of individuals in the first group.
nG: (1 <= nG <= 100), the number of individuals in the second group.
wealth: A list of nR integers, each (0 <= wealth[i] <= 10^6), representing the wealth of individuals in the first group.
Output:
A list of integers of size T, where each integer is the result for the corresponding test case.
File Requirements
The solution must be written in a file called /app/solution.py.