問題一覧 > 通常問題

No.3065 Speedrun (Normal)

レベル : / AI推定難易度 : 243 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 132
作問者 : 👑 AngrySadEight / テスター : 👑 p-adic 👑 hamamu
お気に入りにしたユーザー ProblemId : 11757 / 自分の提出
問題文最終更新日: 2025-02-18 18:43:53
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 461 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。