题库练习 Math Show
← 上一题 下一题 →

A11104 | Math Show

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Polycarp takes part in a math show. He is given $n$ tasks, each consists of $k$ subtasks, numbered $1$ through $k$ . It takes him $t_{j}$ minutes to solve the $j$ -th subtask of any task. Thus, time required to solve a subtask depends only on its index, but not on the task itself. Polycarp can solve subtasks in any order.

By solving subtask of arbitrary problem he earns one point. Thus, the number of points for task is equal to the number of solved subtasks in it. Moreover, if Polycarp completely solves the task (solves all $k$ of its subtasks), he recieves one extra point. Thus, total number of points he recieves for the complete solution of the task is $k+1$ .

Polycarp has $M$ minutes of time. What is the maximum number of points he can earn?

输入格式

The first line contains three integer numbers $n$ , $k$ and $M$ ( $1<=n<=45$ , $1<=k<=45$ , $0<=M<=2·10^{9}$ ).

The second line contains $k$ integer numbers, values $t_{j}$ ( $1<=t_{j}<=1000000$ ), where $t_{j}$ is the time in minutes required to solve $j$ -th subtask of any task.

输出格式

Print the maximum amount of points Polycarp can earn in $M$ minutes.

输入输出样例

输入 #1
3 4 11
1 2 3 4
输出 #1
6
输入 #2
5 5 10
1 2 4 8 16
输出 #2
7
C++ 编辑器
输入
输出