Orig Description
A: Four Tea
Problem
Tea is indispensable for programming contests. It has the effect of relieving the tension of the contestants. [citation needed]
There are N players participating in the contest, and you want to prepare tea for this number of people. There are four types of tea packages, A, B, C, and D, all of which are of the same variety but have different contents. For a package X, it is known that the price of one package is p_X yen, and it can be used to make t_X cups of tea when one is bought.
Find the minimum amount of money required to make tea for N people. Note that it is not necessary to purchase all packages, and it is not necessary to purchase packages that make exactly N cups of tea (it is sufficient if you can make more than N cups).
Input Format
The input is given in the following format.
N
p_A p_B p_C p_D
t_A t_B t_C t_D
In the first line, the number of players participating in the contest is given.
In the second line, the prices of the tea packages A, B, C, and D are given separated by spaces.
In the third line, the number of cups of tea that can be made from tea packages A, B, C, and D are given separated by spaces.
Constraints
1 \leq N \leq 100
1 \leq p_X \leq 100
1 \leq t_X \leq 100
All input values are integers.
Output Format
Print the minimum amount of money required to make tea for N people on a single line.
Sample Input 1
10
1 2 3 4
1 2 4 8
Sample Output 1
6
The optimal solution is to buy one package of B and one package of D.
Sample Input 2
5
2 9 9 8
1 4 5 100
Sample Output 2
8
It is necessary to prepare 20 times the required amount of tea, but buying one package of D is the cheapest option and it can make 5 or more cups of tea.
Sample Input 3
24
2 3 4 7
7 9 11 20
Sample Output 3
8
The optimal solution is to buy two packages of A and one package of C. It is possible that the required amount of tea cannot be made exactly, as in this case.
Extracted Specification
An integer N (1 ≤ N ≤ 100), representing some quantity or size.
A list of four integers P, where each integer p_X (1 ≤ p_X ≤ 100) represents a price.
A list of four integers T, where each integer t_X (1 ≤ t_X ≤ 100) represents a quantity.
### Example Input:
```
10
1 2 3 4
1 2 4 8
```
### Function Signature:
Write a function f(N, P, T) that takes in the input.
def f(N: int, P: List[int], T: List[int]):
'''
N: an integer
P: a list of four integers
T: a list of four integers
'''
Test Case Generator
To write a test case generator for the "Four Tea" problem, we need to create random values for the number of players \(N\), the prices of the tea packages \(p_A, p_B, p_C, p_D\), and the respective number of tea cups \(t_A, t_B, t_C, t_D\) that each package can make. The constraints given in the problem will guide us in generating valid test cases. Here is a sample implementation of the test case generator in Python:
```python
import random
def tcgen():
# Generate a random number of players (1 to 100)
N = random.randint(1, 100)
# Generate random prices for tea packages A, B, C, D (1 to 100)
p_A = random.randint(1, 100)
p_B = random.randint(1, 100)
p_C = random.randint(1, 100)
p_D = random.randint(1, 100)
# Generate random number of cups for tea packages A, B, C, D (1 to 100)
t_A = random.randint(1, 100)
t_B = random.randint(1, 100)
t_C = random.randint(1, 100)
t_D = random.randint(1, 100)
return N, (p_A, p_B, p_C, p_D), (t_A, t_B, t_C, t_D)
# Example of how to use the test case generator
if __name__ == "__main__":
N, prices, tea_cups = tcgen()
print("N:", N)
print("Prices:", prices)
print("Tea cups:", tea_cups)
```
This code will generate a test case with:
- A random number of players \(N\) between 1 and 100.
- Random prices for each type of tea package between 1 and 100.
- Random numbers of tea cups that each package can make, also between 1 and 100.
### Explanation of the Output Structure
- \(N\): Number of players.
- `prices`: A tuple containing the prices of tea packages A, B, C, and D.
- `tea_cups`: A tuple containing the number of tea cups that packages A, B, C, and D can make.
### Example Output
The output from running the generator might look like this:
```
N: 45
Prices: (56, 78, 12, 34)
Tea cups: (7, 14, 20, 45)
```
You can use this generator to create multiple test cases for the problem, ensuring that all inputs are within the specified constraints.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
p = list(map(int, fh.readline().strip().split()))
t = list(map(int, fh.readline().strip().split()))
return N, p, t