No.3065 Speedrun (Normal)
タグ : / 解いたユーザー数 132
作問者 : 👑
hamamu
Problem Statement
You are going to participate in a speedrun contest held on yukicoder.
In the speedrun contest, problems divided into $4$ difficulty levels, $1, 1.5, 2, 2.5$, are given.
There are $A$ problems of difficulty $1$, and it takes $P$ minutes to solve $1$ of them.
There are $B$ problems of difficulty $1.5$, and it takes $Q$ minutes to solve $1$ of them.
There are $C$ problems of difficulty $2$, and it takes $R$ minutes to solve $1$ of them.
There are $D$ problems of difficulty $2.5$, and it takes $S$ minutes to solve $1$ of them.
The duration of the speedrun contest is $T$ minutes. Find the maximum number of problems you can solve within the time limit.
Note that if the total time spent solving problems is exactly $T$ minutes, all of those problems are considered to have been solved within the time limit.
Constraints
- All inputs are integers.
- $1 \leq A, B, C, D \leq 10^9$
- $1 \leq P, Q, R, S \leq 10^9$
- $1 \leq T \leq 4 \times 10^{18}$
Input
The input is given from standard input in the following format.
$A$ $B$ $C$ $D$ $P$ $Q$ $R$ $S$ $T$
Output
Output the maximum number of problems that can be solved within the contest time.
Sample
Sample 1
Input
1 3 3 3 5 10 15 20 120
Output
9
By solving $1$ problem of difficulty $1$, $3$ problems each of difficulty $1.5$ and difficulty $2$, and $2$ problems of difficulty $2.5$, you can solve a total of $9$ problems.
Since it is impossible to solve all $10$ problems, the maximum number of problems you can solve is $9$.
Sample 2
Input
1 3 3 3 5 10 10 15 120
Output
10
You can solve all $10$ problems.
Sample 3
Input
2 7 1 8 2 8 1 8 28
Output
5
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。