Answer the question
In order to leave comments, you need to log in
Who can explain the essence of the problem Three paired maxima?
Given the following task:
You are given three positive (that is, strictly greater than 0) integers x, y, and z.
Your task is to find positive integers a, b and c such that x=max(a,b), y=max(a,c) and z=max(b,c), or determine that it is impossible to find such values a, b and c.
Answer the question
In order to leave comments, you need to log in
If there is no really
clear condition. One can only assume that x ≤ y ≤ z . There are no equality restrictions.
then we argue as follows:
X is the maximum of a and b. For definiteness, we take either a < b or a=b (since equalities are allowed).
Those. we already have b=X. For a, the condition a<=b must be satisfied.
It follows from the conditions Y=max(a,c), Z=max(b,c) and the condition a<=b that с>=b. Then c=Y, c=Z.
Therefore, the condition is satisfied only by such pairs for which either all three given numbers X,Y,Z are equal to each other, or X < Y=Z and then b=X, c=Y=Z, a is an arbitrary number less than or equal to b.
The algorithm boiled down to the fact that you check whether the specified conditions are met and if one of them is met, you directly get your a, b and c without any selection.
A solution exists when
max(x, y) = max(y, z) = max(x, z),
AND .
{if min (x, y, z) < max(x, y, z), then min (x, y, z) > 1}
We leave the proof as a home exercise. ;)
PS my condition almost corresponds to what dmshar outputted , only written in a slightly more general form. I didn't use the x ≤ y ≤ z constraint.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question