433A.md (1452B)
1 Source: https://codeforces.com/problemset/problem/433/A 2 3 A. Kitahara Haruki's Gift 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Kitahara Haruki has bought *n* apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends. 22 23 Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equal to the total weight of the apples given to Ogiso Setsuna. 24 25 But unfortunately Kitahara Haruki doesn't have a knife right now, so he cannot split any apple into some parts. Please, tell him: is it possible to divide all the apples in a fair way between his friends? 26 27 Input 28 29 The first line contains an integer *n* (1 ≤ *n* ≤ 100) — the number of apples. The second line contains *n* integers *w*1, *w*2, ..., *w**n* (*w**i* = 100 or *w**i* = 200), where *w**i* is the weight of the *i*-th apple. 30 31 Output 32 33 In a single line print "YES" (without the quotes) if it is possible to divide all the apples between his friends. Otherwise print "NO" (without the quotes). 34 35 Examples 36 37 Input 38 39 ``` 40 3 41 100 200 100 42 ``` 43 44 Output 45 46 ``` 47 YES 48 ``` 49 50 Input 51 52 ``` 53 4 54 100 100 100 200 55 ``` 56 57 Output 58 59 ``` 60 NO 61 ``` 62 63 Note 64 65 In the first test sample Kitahara Haruki can give the first and the last apple to Ogiso Setsuna and the middle apple to Touma Kazusa.