No.3064 Speedrun (Easy)
タグ : / 解いたユーザー数 160
作問者 : 👑
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$ problem.
There are $B$ problems of difficulty $1.5$, and it takes $Q$ minutes to solve $1$ problem.
There are $C$ problems of difficulty $2$, and it takes $R$ minutes to solve $1$ problem.
There are $D$ problems of difficulty $2.5$, and it takes $S$ minutes to solve $1$ problem.
The duration of the speedrun contest is $T$ minutes. Determine whether you can solve all the problems within the time limit.
Note that if you solve all the problems in exactly $T$ minutes, you are considered to have solved all the problems within the time limit.
Constraints
- All input values are integers
- $1 \leq A, B, C, D \leq 100$
- $1 \leq P, Q, R, S \leq 100$
- $4 \leq T \leq 40000$
Input
The input is given from standard input in the following format.
$A$ $B$ $C$ $D$ $P$ $Q$ $R$ $S$ $T$
Output
Print Yes if you can solve all the problems within the contest time, and No otherwise.
Sample
Sample 1
Input
1 3 3 3 5 10 10 15 120
Output
Yes
There is $1$ problem of difficulty $1$. Since it takes $5$ minutes to solve $1$ problem, it takes $1 \times 5 = 5$ minutes to solve them all.
There are $3$ problems of difficulty $1.5$. Since it takes $10$ minutes to solve $1$ problem, it takes $3 \times 10 = 30$ minutes to solve them all.
There are $3$ problems of difficulty $2$. Since it takes $10$ minutes to solve $1$ problem, it takes $3 \times 10 = 30$ minutes to solve them all.
There are $3$ problems of difficulty $2.5$. Since it takes $15$ minutes to solve $1$ problem, it takes $3 \times 15 = 45$ minutes to solve them all.
From the above, it takes $5 + 30 + 30 + 45 = 110$ minutes to solve all the problems. Therefore, you can solve all the problems within the contest time.
Sample 2
Input
1 3 3 3 5 10 15 20 120
Output
No
There is $1$ problem of difficulty $1$. Since it takes $5$ minutes to solve $1$ problem, it takes $1 \times 5 = 5$ minutes to solve them all.
There are $3$ problems of difficulty $1.5$. Since it takes $10$ minutes to solve $1$ problem, it takes $3 \times 10 = 30$ minutes to solve them all.
There are $3$ problems of difficulty $2$. Since it takes $15$ minutes to solve $1$ problem, it takes $3 \times 15 = 45$ minutes to solve them all.
There are $3$ problems of difficulty $2.5$. Since it takes $20$ minutes to solve $1$ problem, it takes $3 \times 20 = 60$ minutes to solve them all.
From the above, it takes $5 + 30 + 45 + 60 = 140$ minutes to solve all the problems. Therefore, you cannot solve all the problems within the contest time.
Sample 3
Input
100 100 100 100 100 100 100 100 40000
Output
Yes
You can solve all the problems in exactly the contest time.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。