-1
$\begingroup$

You have three numbers, $x, y, z$. You are allowed the following two operations on these numbers.

  • Choose any two numbers and increase them by $1$.
  • Else choose any number and increase them by $2$.

Find the minimum number of operations to make the three numbers equal.

Eg. $x = 2, y = 5, z = 4$. Minimum operations is $2$.

I cannot seem to come up with the solution. Please help.

$\endgroup$
16
  • $\begingroup$ What is your question? Make it clear $\endgroup$ May 18, 2018 at 12:15
  • 1
    $\begingroup$ @Raghav: I mean: if $x+y+z=2+5+4=11$, then after $2$ steps we'll have $x''+y''+z''=11+2\times 2 = 15$, so $x''=y''=z''=\ldots$, so you'll see how to correct each of the numbers $x,y,z$. (for example, $y$ needs no correction). $\endgroup$
    – Oleg567
    May 18, 2018 at 12:22
  • 1
    $\begingroup$ @Raghav sum up the numbers. Let it be s. Now your sum should be either equal to 3n or 3(n+1) where n is highest value amongst x,y,z. Whichever is of same parity as s will be the ultimate sum. $\endgroup$ May 18, 2018 at 12:23
  • 1
    $\begingroup$ For example, 3n=15, 3(n+1)=18. Since 15 is of the same parity as 11. So you ultimate sum will be 15. Now 15-11=4=2.2 So 2 will be the answer. $\endgroup$ May 18, 2018 at 12:24
  • 1
    $\begingroup$ I just figured that in mod 2, it's possible to make three times the first one operation to increase all of the variables by 2 (choose xz, xy and finally yz); and the second operation doesn't change the mod 2 value of the chosen variable. ... Just my train of thought. $\endgroup$
    – Matti P.
    May 18, 2018 at 12:48

1 Answer 1

1
$\begingroup$

Let $x+y+z=s$
where $x>y\ge z$ or $x\ge y>z$
Now the ultimate sum should be either $3x$ or $3(x+1)$ as all the numbers will be equal and the sum will have the same parity as the initial(it increase by 2)
Now since highest value i.e $x=5$
So $3x=15$ and $3(x+1)=18$
Parity of $x+y+z=11 $ is odd as $15$. So $15$ will be the ultimate sum.
Now, $15-11=4$ which is increase in $s$.
At each step it increases by $2$ so minimum steps=${4\over 2} =2$

PS: Variables are different than the ones in the question.

$\endgroup$
2
  • $\begingroup$ Very nice answer indeed. I just don't understand how you came up with the $3x$ or $3(x+1)$ part. Can you please elaborate on that? $\endgroup$
    – Raghav
    May 19, 2018 at 7:24
  • 1
    $\begingroup$ @Raghav- We know that either the sum of all the numbers will be odd or even and will be divisible by $3$. Also one of $3x$ and $3(x+1)$ will be even and odd each. And $3x , 3(x+1)$ is the smallest sum possible for $x,y,z$ which means it will be obtained in smallest number steps. $\endgroup$ May 19, 2018 at 17:37

Not the answer you're looking for? Browse other questions tagged .