Problem p00311 - Generation 2

Orig Description

Fishing Competition
Brothers Hiroshi and Kenjiro came to Lake Inawashiro to go fishing. They decided to compete against each other by assigning points to the fish they caught and adding up the total points.
One iwana is worth a points.
One yamame is worth b points.
Every 10 iwana caught is worth an additional c points.
Every 20 yamame caught is worth an additional d points.
Write a program to determine who won the competition, or if it is a tie, based on the number of fish caught by each person.
Input
The input is given in the following format:
h1 h2
k1 k2
a b c d
The first line contains the number of iwana h1 (0 ≤ h1 ≤ 100) and yamame h2 (0 ≤ h2 ≤ 100) caught by Hiroshi. The second line contains the number of iwana k1 (0 ≤ k1 ≤ 100) and yamame k2 (0 ≤ k2 ≤ 100) caught by Kenjiro. The third line contains the points assigned to one iwana a (1 ≤ a ≤ 100), one yamame b (1 ≤ b ≤ 100), the additional points awarded for every 10 iwana caught c (0 ≤ c ≤ 100), and the additional points awarded for every 20 yamame caught d (0 ≤ d ≤ 100).
Output
Output hiroshi if Hiroshi wins, kenjiro if Kenjiro wins, or even if it is a tie.
Sample Input 1
5 1
3 1
1 2 5 5
Sample Output 1
hiroshi
Sample Input 2
5 1
4 2
1 2 5 5
Sample Output 2
kenjiro
Sample Input 3
0 20
10 0
1 1 10 0
Sample Output 3
even

Extracted Specification

An integer h1 (0 ≤ h1 ≤ 100) and an integer h2 (0 ≤ h2 ≤ 100).
An integer k1 (0 ≤ k1 ≤ 100) and an integer k2 (0 ≤ k2 ≤ 100).
An integer a (1 ≤ a ≤ 100), an integer b (1 ≤ b ≤ 100), an integer c (0 ≤ c ≤ 100), and an integer d (0 ≤ d ≤ 100).

### Example Input:

```
5 1
3 1
1 2 5 5
```

### Function Signature:
Write a function f(h1, h2, k1, k2, a, b, c, d) that takes in the input.
def f(h1: int, h2: int, k1: int, k2: int, a: int, b: int, c: int, d: int):
    '''
    h1: an integer
    h2: an integer
    k1: an integer
    k2: an integer
    a: an integer
    b: an integer
    c: an integer
    d: an integer
    '''

Test Case Generator

To generate test cases for the "Fishing Competition" problem, we can write a Python function that randomly produces valid inputs based on the constraints provided in the problem statement. The function will generate random numbers for the number of fish caught by each brother, the points assigned to each type of fish, and the additional points for every 10 iwana and 20 yamame caught.

Here is the test case generator:

```python
import random

def tcgen():
    # Number of fish caught by Hiroshi
    h1 = random.randint(0, 100)
    h2 = random.randint(0, 100)
    
    # Number of fish caught by Kenjiro
    k1 = random.randint(0, 100)
    k2 = random.randint(0, 100)
    
    # Points assigned to each type of fish
    a = random.randint(1, 100)
    b = random.randint(1, 100)
    
    # Additional points for every 10 iwana and 20 yamame caught
    c = random.randint(0, 100)
    d = random.randint(0, 100)
    
    return (h1, h2), (k1, k2), (a, b, c, d)

# Example Usage:
for _ in range(3):
    hiroshi, kenjiro, points = tcgen()
    print(f"{hiroshi[0]} {hiroshi[1]}")
    print(f"{kenjiro[0]} {kenjiro[1]}")
    print(f"{points[0]} {points[1]} {points[2]} {points[3]}")
    print()
```

This generator function `tcgen()` produces a tuple of tuples containing random values for the number of fish caught by each brother and the points assigned to each type of fish along with additional points for every 10 iwana and 20 yamame caught. The function also ensures that the generated values adhere to the constraints outlined in the problem statement.

To use the test case generator, you can call `tcgen()` and it will print out the generated input values in a format that matches the problem's input specification. This will help you test your solution against a variety of randomly generated cases.

Extract Arguments

def extract_arguments(fh):
    h1, h2 = map(int, fh.readline().strip().split())
    k1, k2 = map(int, fh.readline().strip().split())
    a, b, c, d = map(int, fh.readline().strip().split())
    return (h1, h2), (k1, k2), (a, b, c, d)