Logo
(追記) (追記ここまで)

30529번 - Double Up 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB39272668.421%

문제

A Double Up game consists of a sequence of $n$ numbers $a_1, \ldots, a_n,ドル where each $a_i$ is a power of two. In one move one can either remove one of the numbers, or merge two identical adjacent numbers into a single number of twice the value. For example, for sequence 4,2,2,1,8ドル,ドル we can merge the 2ドル$s and obtain 4,4,1,8ドル,ドル then merge the 4ドル$s and obtain 8,1,8ドル,ドル then remove the 1ドル,ドル and, finally, merge the 8ドル$s, obtaining a single final number, 16ドル$. We play the game until a single number remains. What is the largest number we can obtain?

입력

The input consists of two lines. The first line contains $n$ (1ドル \leq n \leq 1000$). The second line contains numbers $a_1, \ldots, a_n,ドル where 1ドル\leq a_i\leq 2^{100}$ for each $i$.

출력

The ouput consists of a single line containing the largest number that can be obtained from the input sequence $a_1, \ldots, a_n$.

제한

예제 입력 1

5
4 2 2 1 8

예제 출력 1

16

힌트

출처

ICPC > Regionals > North America > East Central North America Regional > 2023-2024 East Central NA Regional Contest F번

ICPC > Regionals > North America > Greater New York Region > 2023 Greater New York Programming Contest D번

  • 문제를 만든 사람: Daniel Štefankovič, Ivona Bezáková
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /