Need help with a problem

Revision en1, by 21August, 2018-03-14 13:08:23

Hello. Suppose you have n boxes and there are a[i] balls in the i-th box. In one operation you can choose2 balls from 2 different boxes and throw them. Is it possible to perform some number of operations such that in the end a[i] = 0 for all i? I know that the answer is yes iff a[i] <= s/2 for all i, where s is tue sum of a[i]. But why is this condition sufficient? I understand that its not possible to make a[i] = 0 when a[i] > s/2, but why does this guarantee that we will be able to reach the state where all a[i] = 0? Thanks in advance.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English 21August 2018-03-14 13:11:38 52
en1 English 21August 2018-03-14 13:08:23 568 Initial revision (published)