Marble exchanges P24544


Statement
 

pdf   zip

html
Edgar has a collection of red, blue and yellow marbles. As many times as he wishes, he can only make one operation: exchanging two marbles of different colours (one of each colour) for one of the remaining colour. Given (R, B, Y) (the number of marbles of each colour), can you determine whether Edgar will be capable of keeping just one of the marbles?

For instance, from (1, 1, 2) he can move to (2, 0, 1), from there to (1, 1, 0), and from there to (0, 0, 1). By contrast, it is not difficult to see that from (1, 1, 3) he cannot reach any of (1, 0, 0), (0, 1, 0) or (0, 0, 1).

Input

Input consists of several cases, each one with three integers R, B and Y, all of them between 0 and 109. Assume R + B + Y > 0.

Output

For every case, print “YES” if Edgar can achieve a situation where R′ + B′ + Y′ = 1, and print “NO” otherwise. Obviously, none of the three variables can go below zero at any moment.

Public test cases
  • Input

    1 1 2
    1 1 3
    0 1 0
    7 4 2
    

    Output

    YES
    NO
    YES
    YES
    
  • Information
    Author
    Jordi Rodriguez
    Language
    English
    Official solutions
    C++
    User solutions
    C++