#P9761. [ROIR 2021] 两台机器 (Day 1)
[ROIR 2021] 两台机器 (Day 1)
Background
Translated from ROIR 2021 Day 1 T1 Два станка。
Problem Description
There are two machines. The first machine needs minutes to start up, and then it produces parts per minute. The second machine needs minutes to start up, and then it produces parts per minute. The two machines cannot be in the startup process at the same time.
You have a total of minutes. Find the maximum number of parts that can be produced.
Input Format
The first line contains an integer .
The second line contains two integers .
The third line contains two integers .
Output Format
Output a single integer: the maximum number of parts that can be produced.
20
10 4
5 3
65
Hint
[Sample Explanation]:
If you start the second machine first and then start the first machine, you can produce parts.
[Constraints]:
For all subtasks, . The final answer can be stored in long long.
| Subtask ID | Special Constraints | Score |
|---|---|---|
| None |
Translated by ChatGPT 5