#K80802. Maximum Valid Soccer Teams Formation
Maximum Valid Soccer Teams Formation
Maximum Valid Soccer Teams Formation
In this problem, you are given the number of available players for four different roles: Forwards, Midfielders, Defenders, and Goalkeepers. A valid soccer team must have at least one Forward, at least one Midfielder, at least one Defender, and exactly one Goalkeeper. Moreover, the total number of players in a team must not exceed 11. Mathematically, if you have ( f ) Forwards, ( m ) Midfielders, ( d ) Defenders, and ( g ) Goalkeepers, then the maximum number of valid teams that can be formed is given by: [ \text{teams} = \min(f,, m,, d,, g) ] It is guaranteed that with the minimum required players for each role, the total count per team will not exceed 11. Your task is to compute the maximum number of valid teams that can be formed for a given set of inputs.
inputFormat
The input is given via standard input and begins with an integer ( T ) representing the number of test cases. Each of the following ( T ) lines contains four space-separated integers ( f ), ( m ), ( d ), and ( g ) which denote the number of Forwards, Midfielders, Defenders, and Goalkeepers available, respectively.
outputFormat
For each test case, output a single line containing the maximum number of valid teams that can be formed.## sample
1
7 5 4 2
2
</p>