Send your feedback or ask for help here!
I think the problem is a fun exercise and it’s great it’s here.
However does it really need to be gendered in this way?
We all know that in the tech industry we struggle to attract diverse people and codingame is the first contact with development for a lot of people. So I think it’s too bad that an exercise on this website conveys genders stereotypes like “girls don’t want boys to know their weight”.
I think it should be pretty straightforward to reword it lightly to make it a group of people or to find another story explaining why an observer would only have access to the grouped measurements.
I’m not sure what’s the process to do this kind of change but if I can be helpful I’m up to give a hand rewording the exercise
This puzzle would be more appropriate on a math forum
Great little brain-teaser. Another excellent production from java_coffee_cup.
This doesn’t need loops. Just some basic calculations.
Find s = sum of total weights to 5 girls by calculating sum of pairs of weights divide by 4.
Calculate the middle girl by subtracting s to the first pair and the last pair.
Focus on the first two sums and the last two sums and the weight of the middle girl.
A little spoiler in python
Sum of weights of 5 girls and the middle girl:
w =  for i in input().split(): w.append(int(i)) c = sum(w)//4 - w - w[-1]
I think this exercise is missing some informations about the order the people are paired up.
indeed their is not only one possible ordering.
For instance, I would assume that for people A, B, C, D, E , the order would be:
AB AC AD AE BC BD BE CD CE DE
The order isn’t needed to be known (and if you did know it it would be a much easier problem to solve).
some hints to solve this puzzle :
Let say we have 5 girls with weights ( A,B,C,D and E) Where : A <= B <= C <= D < E
min = A+B is the minimum pairwise weight
max = D+E is the maximum pairwise weight
A+B < A+C < … < C+E < D+E
the sum of all 10 pairwise weight measurements :
sum = (A+B) + (A+C) + (A+D) + (A+E) + (B+C) + (B+D) + (B+E) + (C+D) + (C+E) + (D+E) = 4 * A + 4 * B + 4 * C + 4 * D + 4 * E = 4 * (A + B + C + D + E)
- A + B + C + D + E = sum / 4
you can calculte the weight C :
- C = sum/4 - max - min
you can solve the rest by yourself
thanks to @khanglovesIT for the hints
Actually you used loop for summing up values into w array.
Well, algebra is a longtime forgotten memory for me. I went into a full equation solver starting from the weights. However, my paper solution did not cover all the possibilities
I should have checked this forum earlier, for this simple 4abcd*e solution. Another “strive for simplicity” problem. Thanks, great exercice.