#Lutece3326. Muzikant
Muzikant
Description
Muzikant aspires to be a musician and has learned how to write a music score.
A score is made up of several bars, each containing notes of various lengths. The duration of a binary note is half of a bar, while a crotchet is one-quarter and a quaver is one-eighth. Muzikant soon discovered that the duration of most notes is equal to the duration of of a bar.[1]
Muzikant then tried to write a score himself. He was so engrossed in his composition that he lost track of how long he had been writing. He wonders whether the notes he has written down could exactly form a bar. So he hands you his score and asks for your assistance.
More precisely, the score given to you by Muzikant consists of notes, and the duration of the -th note is of a bar. Your task is to check whether these notes can form an exact bar, in other words, whether the sum of all notes' duration is equal to the duration of a bar.
Input
The first line contains an integer , the number of notes in Muzikant's score.
The second line contains integers , denoting the duration of the -th note in Muzikant's score is -th of a whole bar.
Output
If the notes in Muzikant's score can exactly form a single bar, print a single line Yes
. Otherwise, print No
.
Samples
2
1 1
Yes
3
1 2 2
Yes
10
4 4 3 3 3 4 4 3 3 3
Yes
9
3 3 3 3 4 4 4 4 3
No
Note
For the sake of simplicity, we assume that the duration of a bar is 1 second.
In the first example, Muzikant wrote two notes with the duration of seconds. Obviously, two halves make a whole bar.
In the second example, Muzikant wrote three notes of s, s, s, respectively. Since , these three notes form a bar.
In the third example, the total length of notes is , so the answer is Yes
.
In the fourth example, the total length of notes is , so the answer is No
.
Resources
电子科技大学第十四届 ACM 趣味程序设计竞赛
Indeed, there are many notes whose duration doesn't match that form, such as triplets, but here we will not take them into consideration. Besides, for the sake of simplicity, here we only consider bars of beat. ↩︎