QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 64 MB 總分: 10

#6014. 存钱罐 [B]

统计

在拜特国(Bajtocja),作为一个信息化国家,流通的货币面值仅为 2 的幂次(单位为拜特币)。例如,存在面值为 1、16 或 128 拜特币的硬币;而面值为 3 或 12 拜特币的硬币则不存在。

拜特(Bajtek)是拜特国的一名年轻居民,家里有一个大存钱罐。每天放学回家后,他都会收到一枚拜特币硬币作为零花钱,并立即将其投入存钱罐中。

距离拜特开始收集硬币已经过去了很多天,存钱罐已经装满了。于是拜特决定把它砸开,取出所有的硬币。他现在要去银行,将其中一部分硬币兑换成其他硬币。他希望通过这种方式,使得他所拥有的硬币中,面值最大的一枚硬币的面值尽可能大。这个面值是多少?

输入格式

输入的第一行包含一个整数 $n$ ($1 \le n \le 1\,000\,000$),表示拜特投入存钱罐的硬币数量。下一行包含这些硬币的描述,由 $n$ 个自然数 $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 201\,718$) 组成,表示存钱罐中硬币的面值分别为 $2^{a_1}, 2^{a_2}, \dots, 2^{a_n}$ 拜特币。

输出格式

输出的第一行应包含一个自然数 $b$,表示拜特能够获得的硬币中,面值最大的一枚硬币的面值为 $2^b$ 拜特币。

样例

输入 1

5
3 4 1 3 3

输出 1

5

说明 1

存钱罐中的硬币面值分别为 8, 16, 2, 8 和 8 拜特币,总价值为 42 拜特币。为了获得更大的面值,拜特可以在银行将面值为 8, 16, 8 和 8 的硬币(总价值 40 拜特币)兑换成面值为 32, 4 和 4 的硬币(总价值同样为 40 拜特币)。他所能获得的硬币中,面值最大的一枚将是 $2^5$ 拜特币。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.