Equal to the sum of the rest (II) P87920


Statement
 

pdf   zip

html

Write a program that, given a sequence of integer numbers, tells if there is any number equal to the sum of the rest.

Input

Input contains several cases. Each case begins with a number n≥1 followed by n integer numbers.

Output

For each case, tell if it has a number equal to the sum of the rest.

Public test cases
  • Input

    4   3 4 -1 2
    7   1 0 3 3 1 0 2
    1   0
    1   -4
    2   -3 -3
    3   -1 -4 -5

    Output

    YES
    NO
    YES
    NO
    YES
    YES
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++