QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#7255. 镜饼

Statistics

镜饼(Mirror Rice Cake,一种年糕堆叠而成的日本传统食物)是庆祝新年时常用的食物。

Snuke 有 $N$ 个年糕,他想用这些年糕制作一个镜饼。第 $i$ 个年糕的重量为 $a_i$。他希望通过选择其中的一些年糕并按某种顺序堆叠来制作镜饼。此外,堆叠必须满足以下约束:对于堆中的每一个年糕,其上方所有年糕的总重量必须严格小于该年糕自身的重量。

计算他制作镜饼时最多可以使用多少个年糕。

输入格式

第一行包含一个整数 $N$ ($1 \le N \le 1000$)。接下来的 $N$ 行,每行包含一个整数 $a_i$ ($1 \le a_i \le 10^9$),表示第 $i$ 个年糕的重量。

输出格式

输出 Snuke 制作镜饼时最多可以使用的年糕数量。

样例

输入格式 1

5
3
20
5
8
6

输出格式 1

3

说明

例如,从上到下堆叠重量分别为 $3, 5, 20$ 的三个年糕。

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.