Minimize sum of smallest and largest among integers on the real line. Suppose there are 3 non-negative integers $x$, $y$ and $z$ on the real line.
We are told that $x + y + z = 300$. Without loss of generality, assume
 $x$ to be the smallest integer, and $z$ to be the largest.
How do I minimize $(x + z)$?
Attempt: $x + z = 300 - y$, so for a start I should maximize y. This occurs at $y = z - 1$. So, we have $x + 2z = 301$. Now, $z = \dfrac {301}2 - \dfrac x2$. $\dfrac {dz}{dx} = -\dfrac 12$. Increasing $x$ by $1$ decreases $z$ only by $\dfrac12$. So, I should pick the smallest possible $x$, which is $1$. Then, $z = 150$. $\min (x+z) = 151$.
Questions


*

*Is my logic correct?

*Is there a systematic way to solve questions of this kind? i.e. given non-negative numbers on the real line that sum up to a fixed value, how to minimize the sum of the largest and smallest of them?

 A: Your logic is fine.  Working with integers there are sometimes "end effects".  You seem to be requiring that $y \ne z$ and an alternate solution is $(0,149,151)$ but that has the same sum of $x+z$.  Without the restriction that $y \ne z$ you could have $(0,150,150)$ for a sum of $150$
Your approach is quite systematic.  If you had to have $7$ different non-negative integers sum to $300$ and wanted to minimize the sum of smallest plus largest, you would argue the same way-you want the middle ones to be as large as possible, so you have six numbers that add to $300$ (or a little less), so the average one is $50$, so they are $(47,48,49,50,51,52)$ and you need to add a $3$ to make $300$ and the sum is $3+52=55$.  You don't really need the derivative here.
A: so let us consider  two case
1.$z=y$
in this case you have $x+2*z=150$.   here $x+z$   could be possible if $x=0$ and $z=150$ ;
otherwise  you get $y$  bigger then  $z$,which contradicts  condition of being $z$ largest integer,now let us consider  second  situation
2.$z>y$
here   $x+z=300-y$ 
because  $z>y$,it means that  $y<150$ and $z>150$,as $x>=0$ and $z>150$  ,we get $x+z>150$,so only possible is  sum  of $x+z$ is minimum if and only if  $x+z=150$
