시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB40329927475.275%

문제

Listening to music is a good way to take one’s mind off the monotony of typing out solution after correct solution.

However, it can be very annoying to start listening to a tune and then for time to run out early, cutting the listening short. How much more satisfying it would be if you could choose tunes to fit the time available!

With this in mind, you have found a way to code musical scores into simple lists of numbers representing the length of the notes in each tune as follows:

Code Name Length
0 breve 2 notes
1 semibreve 1 notes
2 minim 1/2 notes
4 crotchet 1/4 notes
8 quaver 1/8 notes
16 semiquaver 1/16 notes

Given such a list of numbers, calculate the length of the tune in notes.

입력

  • One line containing the integer N (1 ≤ N ≤ 2000), the number of values in the tune.
  • one line containing N integers each representing the length of a value using the codes above.

출력

Output the length of the tune, as a real number of notes. The output must be accurate to an absolute or relative error of at most 10−6.

예제 입력 1

4
1 1 1 0

예제 출력 1

5

예제 입력 2

10
1 2 2 2 1 4 4 8 8 16

예제 출력 2

4.3125

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2017 J번

  • 문제를 만든 사람: Jim Grimmett