..(perhaps not the most elegant) is to maximize over the number of white balls first, and then over the total number of balls in the jar second.
So let n=total number of balls in the jar with the smaller (or an equal) number of balls (in your notation n=w+b ) and w=number of white balls in that jar. Then 1 <= n <= 50 (we're assuming each jar has at least one ball in it) and 0 <= w < = n. As you wrote,
p = 1/2 ( w/ n + (50-w)/(100-n) )
= 1/2 ( w (100-2n)/n/(100-n) + 50/(100-n) )
Since (100-2n)/n/(100-n) >= 0, this is obviously maximized for fixed n by the largest value of w, which is w=n, and then
p = 1/2 (150-2n)/(100-n)
= 1 - 25/(100-n)
And this is obviously maximized by the smallest value of n, which is n=1, with
p = 74/99
[edit: a mathematical symbol turned into an emoticon :) )
So let n=total number of balls in the jar with the smaller (or an equal) number of balls (in your notation n=w+b ) and w=number of white balls in that jar. Then 1 <= n <= 50 (we're assuming each jar has at least one ball in it) and 0 <= w < = n. As you wrote,
p = 1/2 ( w/ n + (50-w)/(100-n) )
= 1/2 ( w (100-2n)/n/(100-n) + 50/(100-n) )
Since (100-2n)/n/(100-n) >= 0, this is obviously maximized for fixed n by the largest value of w, which is w=n, and then
p = 1/2 (150-2n)/(100-n)
= 1 - 25/(100-n)
And this is obviously maximized by the smallest value of n, which is n=1, with
p = 74/99
[edit: a mathematical symbol turned into an emoticon :) )